subsonic3

Issue with Linq Join (subsonic)

[亡魂溺海] 提交于 2019-12-09 01:56:29
I have this slice of code IQueryable<Dealer> dealers = from dealer in Dealers join address in AddressesUS on dealer.DealerId equals address.OwnerId where dealer.Country == country && address.Owner == (int)Contact.OwnerType.Dealer select new Dealer() { DealerId = dealer.DealerId, DealerName = dealer.DealerName, Country = dealer.Country, Email = dealer.Email, Contact = dealer.Contact, Url = dealer.Url, IsActive = dealer.IsActive, IsWholesale = dealer.IsWholesale, Address = address == null ? null : address }; When I execute it (by calling ToArray or whatever), I get this error: System

variable 'x' of type 'Product' referenced from scope, but it is not defined

ε祈祈猫儿з 提交于 2019-12-08 15:33:18
问题 I have a class named Product in class library project. I am using SubSonic SimpleRepository to persist objects. I have a method as follows in Product class: public static IList<Product> Load(Expression<Func<Product, bool>> expression) { var rep=RepoHelper.GetRepo("ConStr"); var products = rep.Find(expression); return products.ToList(); } I'm calling this function like this: private void BindData() { var list = Product.Load(x => x.Active);//Active is of type bool rptrItems.DataSource = list;

Sub Sonic not closing connections

ぃ、小莉子 提交于 2019-12-08 12:39:04
问题 I'm using Linq from SubSonic 3 like this: for(int x; x < 100; x++) { var v = (from c in db.categories where c.parent == 10 select c); if (v.Count() > 0) return null; category[] c = v.ToArray(); } for some reason SubSonic is not closing the connections...so after a few runs of the above loop I run out of SQL connections in the pool or MySQL just refuses to allow more connections...I've tried this both with SS 3.0.3 and with SVN, and I keep getting these errors. What should I be doing to close

SubSonic and MS SQL Server Compact - Data Provider

筅森魡賤 提交于 2019-12-08 11:52:49
问题 I developing new application and I would like using SubSonic and SQL Server Compact. But when I run my simple app (for trying SubSonic) I get exception "Unable to find the requested .Net Framework Data Provider. It may not be installed." Anyone have some advice for me, how solve this? I have reference to System.Data.SqlServerCe UPDATE I downloaded SubSonic latest source code and all code about SQL CE is in comments. I uncomment, but I get same exception. DbDataProvider.cs 回答1: EDIT: SQL

RIA DomainService + ActiveRecord

假如想象 提交于 2019-12-08 10:20:27
问题 I tried to use SubSunsonic.ActiveRecord in SL3 project that uses .NET RIA Services. However when I try to return some IQuerable in DomainService class I get an error that the classes generated by Subsonic have a property 'Columns' with an unsupported type. That's what I have public IEnumerable<SE_NorthWind.SuperEmployee> GetIntegers() { return SE_NorthWind.SuperEmployee.All() .Where(emp => emp.Issues > 100) .OrderBy(emp => emp.EmployeeID); } And this is the error I get Error 7 Entity 'SE

Subsonic 3 Guid as PK always gives me 00000000-0000-0000-0000-000000000000

℡╲_俬逩灬. 提交于 2019-12-08 09:52:25
问题 Using Subsonic 3, Simple Repository the Add always gives me a 00000000-0000-0000-0000-000000000000 for my PK which obviously causes an error in my DB. I see that the definition of my PK created by Subsonic is using newid() but still having this issue. Anyone else having this problem? FYI I am using a local SQL Server 2005 DB sitting in my App_Data directory. 回答1: When you use Guid's SubSonic expects you to set them. Your best bet is to Guid.NewGuid() in the constructor. Remember that the

SubSonic generated DB Schema, binary types?

强颜欢笑 提交于 2019-12-08 08:54:23
问题 How do you create binary columns in the DB using SubSonic's Schema builder? So tonight I decided to dive into SubSonic. I see a lot of questions on here and great responses by Rob and many others. I see that SubSonic is an ORM, with the T4 Templates it can generate some very nice and efficient classes from an existing database. But, I want to go the other way. I have a very rich Domain, and want to create my tables adhoc from my Domain using SubSonic and the RunMigrations option. All works

Issue with Linq Join (subsonic)

余生长醉 提交于 2019-12-08 08:06:06
问题 I have this slice of code IQueryable<Dealer> dealers = from dealer in Dealers join address in AddressesUS on dealer.DealerId equals address.OwnerId where dealer.Country == country && address.Owner == (int)Contact.OwnerType.Dealer select new Dealer() { DealerId = dealer.DealerId, DealerName = dealer.DealerName, Country = dealer.Country, Email = dealer.Email, Contact = dealer.Contact, Url = dealer.Url, IsActive = dealer.IsActive, IsWholesale = dealer.IsWholesale, Address = address == null ?

Funky Sql Generated using SubSonic Simple Repository, LINQ and ASP.NET MVC

泪湿孤枕 提交于 2019-12-08 05:46:56
问题 I have the following code: if (collection["Filter"] == "2") { presentations = presentations.Where(x => x.Speaker.FirstName.StartsWith("B")). OrderBy(x => x.Speaker.FirstName); } this generates the following sql: SELECT [t0].[Description], [t0].[EventId], [t0].[Id], [t0].[PresentedOn], [t0].[Slug], [t0].[SpeakerId], [t0].[Title], [t0].[Url] FROM [Presentations] AS t0 LEFT OUTER JOIN [Speakers] AS t1 ON ([t1].[Id] = [t0].[Id]) WHERE ([t1].[FirstName] LIKE 'B' + '%') ORDER BY [t1].[FirstName]

Subsonic 3 - Update NullReferenceException

做~自己de王妃 提交于 2019-12-08 05:25:10
问题 I am using Subsonic v3.0.0.3 with the Linq templates. I am attempting to update a record in a SQL Server Express database with the following: var db = new MyDB(Constants.Database); db.Update<Contact>() .Set(d => d.FirstName == contact.FirstName) .Where(d => d.Id == contact.Id) .Execute(); I am receiving a NullReferenceException when this line is executed. The stack trace is as follows: at SubSonic.Query.Update.GetCommand() at SubSonic.Query.Update.Execute() Any chance that someone may be able