"select new " not working?

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
jamesr
Posts: 3
Joined: Tue 28 Jul 2009 23:24

"select new " not working?

Post by jamesr » Tue 28 Jul 2009 23:33

Purchased postgres data connector and have a linq to pgsql model.

i have a simple query:

Code: Select all

var members = from m in dc.Members
			where m.IsActive == true
			select new aspnet_User
                       {
UserId = m.UserLoginId,
....
                       }
and the class is defined like this:

Code: Select all

public class aspnet_User
	{
		public int UserId { get; set; }
		public string UserName { get; set; }
		public string LoweredUserName { get; set; }
		public System.Nullable LastActivityDate { get; set; }
		public string Password { get; set; }
		public System.Nullable PasswordFormat { get; set; }
		public string PasswordSalt { get; set; }
		public string Email { get; set; }
		public string LoweredEmail { get; set; }
		public string PasswordQuestion { get; set; }
		public string PasswordAnswer { get; set; }
		public bool IsApproved { get; set; }
		public bool IsLockedOut { get; set; }
		public System.Nullable CreationDate { get; set; }
		public System.Nullable LastLoginDate { get; set; }
		public System.Nullable MustChangePassword { get; set; }
		public System.Nullable LastPasswordChangedDate { get; set; }
		public System.Nullable LastLockoutDate { get; set; }
	}
On runtime this crashes with the error: The operation would destabilize the runtime.
With the Microsoft Linq to sql tools we do not have this problem, don't get why this wouldn't work.

Does your software not support the "select new .." query function?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 29 Jul 2009 14:09

If the Source property of the aspnet_Users class is empty and the Table attribute is present in code,
feel free to remove it (we are working on this wrong behaviour). Everything should work ok in this case.
But if this property is present (the class represents a table in the database), please send me
(support * devart * com) a small test project illustrating the situation.

jamesr
Posts: 3
Joined: Tue 28 Jul 2009 23:24

re

Post by jamesr » Wed 29 Jul 2009 20:44

the aspnet_user class is a custom class I built, it is not defined in the lqml entity model.

At the end I just did a foreach loop on the returned object and built the List by hand.

It would be nice if your software could support anonymous typing like ms linqtosql does.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 30 Jul 2009 08:36

I have just tried to reproduce the problem using dotConnect for PostgreSQL 4.55.37 and failed.
If possible, please send me (support * devart * com, subject "LINQ: The operation would destabilize
the runtime") a small test project illustrating the problem.

Post Reply