c# - Entity Framework 6 and navigational property issue -
im hoping help here. im new ef , having troubles. using database first approach , have database in azure have retreive info from.
[datacontract] [table("a")] public class agencydc { [datamember] [key] public string aid { get; set; } public string aname { get; set; } public string generalemailaddress { get; set; } public string websiteurl { get; set; } [datamember] [foreignkey("aid")] [ignoredatamember] public virtual aextensiondc aextension { get; set; } } [datacontract] [table("aextension")] public class aextensiondc { [datamember] [key] public string aid { get; set; } [datamember] public bool? isactive { get; set; } public bool? isoptedout { get; set; } public datetime? lastupdated { get; set; } }
i trying utilize ef6 retreive records using dbsets in context..
public list<adataccontract> getallas() { using (acontext _actx = new acontext()) { var mylist = _actx.a.include("aextension").tolist(); homecoming mylist; } }
now, should getting 547 records 1 of them having aextension navigational property having content within. other 546 records should contain null. however, reason, getting appears record has match in both tables. in sql speak, kind of want left bring together homecoming rows ae entity , optionally matches in ae.
i hope makes sense.
if possible, if have fix, please post illustration referent? stuck.
i think reply might of way? http://stackoverflow.com/a/4299667/78551
basically include left outer bring together or left bring together 'outer' optional in sql.
c# entity-framework wcf
No comments:
Post a Comment