I am matching Condo records to rental transactions or rather fixing an application that does.
- MatchFields is a class that inherits from an Abstract class which has an AutoMatic Property of type Condominium
- There is also a Condominium dBSet in the Context repository as well as a Class object Condomium. The syntax highlighted is as follows
"ReadWriteProperty_OfType_Condominium_Of_Class_ThatIheritsThePropertyFrom_an_AbstractClass = new CondominiumClassObject_OfType_Condominium(condoRecord_from_DbSet_ContextObject),"
I apologize if that is not very clear, unfortunately I can only give abstract info, not actual data here as I am prohibited under contract. Here is the exact Method below:
private static List
{
List
from transRecord in context.ManyToManyResultMatch
where
condoRecord.Area == transRecord.Area &&
condoRecord.Address == transRecord.Address &&
condoRecord.AptNo == transRecord.AptNo
select
new MatchFields()
{
Condominium = new Condominium(condoRecord),
MatchRecords = transRecord,
//MatchRecords contains data I have not figured out yet
}).Load();
LoadCondoResult(context);
return match;
}
I am trying to fix a bug made by a previous developer on a project and I'm very new to LINQ and EntityFramework. The issue I'm running into is that on "Condominium = new Condominium(condoRecord),..." I get the fabled error "Only parameterless constructors and initializers are supported in LINQ to Entities" My problem resides in the fact that I understand the error message and its nature I do not know the syntax well enough to resolve the problem because I cannot visualize the solution. I've been fixing bugs left and right. Can anybody help me out here? I'm really stuck.

Sukesh MarlaPosted Aug 14, 2012, 3:30 AM
List match = (from condoRecord in context.Records
from transRecord in context.ManyToManyResultMatch
where
condoRecord.Area == transRecord.Area &&
condoRecord.Address == transRecord.Address &&
condoRecord.AptNo == transRecord.AptNo
select
new MatchFields()
{
Condominium = new Condominium()
{
Property_which_stores_condoRecord=condoRecord
},
MatchRecords = transRecord,
}).Load();
LoadCondoResult(context);
return match;
Your Response is important to use. Please Check This is Currect Answer, if it helped
Sukesh MarlaPosted Aug 16, 2012, 12:51 PM
Chris CampbellPosted Aug 14, 2012, 5:00 AM
Thank you! Yes, that got me passed that bug, now I have to battle with the System.OutOfMemoryException which is most likely the result of bad querying that I'll have to look into further and profiler/trace. I really appreciate your help, for the life of me I could not figure out that stupid syntax change, I am a total novice when it comes to class initializers and I'm just now getting into LINQ and EF so anytime I see objects in a relational LINQ to SQL query my eyes glaze over like a deer in the headlights.
Many thanks!