Linq query by using select new
public class Parent
{
public ParentId{get;set;}
public ParentName{get;set;}
public List<Child> childs{get;set;}
}
public class Child
{
public ChildId{get;set;}
public ChildName{get;set;}
}
How can i move data from Domain Entity To Business Entity using Linq
List<Parent> parents=GetALLParentData();
List<ParentBE> parentBE=from p in parents
select new ParentBE
{
ParentId=p.ParentId,
ParentName=p.ParentName,
ChildBE.ChildId=p.Child.ChildId,
ChildBE.ChildName=p.Child.ChildName
}
long Child.ChildId
Error:
An object reference is required for the non-static field, method, or property 'Child.ChildId.get'
string Child.ChildName
Error:
An object reference is required for the non-static field, method, or property 'Child.ChildName.get'
How can move the data of List Of child domain entity to business entity along with parent domain entity to business entity using LINQ