Page 1 of 1

"select new " not working?

Posted: Tue 28 Jul 2009 23:33
by jamesr
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?

Posted: Wed 29 Jul 2009 14:09
by AndreyR
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.

re

Posted: Wed 29 Jul 2009 20:44
by jamesr
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.

Posted: Thu 30 Jul 2009 08:36
by AndreyR
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.