मैं निम्नलिखित मॉडल है:ग्राफडिफ़ का उपयोग कर संबंधित इकाइयों को कैसे अपडेट करें?
public class Customer
{
public int Id {get; set;}
public string Name {get; set;}
public int AddressId {get; set;}
public virtual Address Address {get; set;}
public virtual ICollection<CustomerCategory> Categories {get; set;}
}
public class CustomerCategory
{
public int Id {get; set;}
public int CustomerId {get; set;}
public int CategoryId {get; set;}
public virtual Category Category {get; set;}
}
public class Address
{
public int Id {get; set;}
public string Street{get; set;}
public virtual PostCode PostCode {get; set;}
}
ऊपर से, और GraphDiff का उपयोग कर, मैं इस प्रकार ग्राहक कुल अपडेट करना चाहते हैं:
dbContext.UpdateGraph<Customer>(entity,
map => map.AssociatedEntity(x => x.Address)
.OwnedCollection(x => x.Categories, with => with.AssociatedEntity(x => x.Category)));
लेकिन ऊपर कुछ भी अपडेट नहीं हो रहा है !!
इस मामले में ग्राफडिफ़ का उपयोग करने का सही तरीका क्या है?
तुम भी उपयोग कर सकते हैं [ 'EntityGraphOperations'] (https://github.com/फरहाद जबीयेव/एंटिटीग्राफऑपरेशंस) लाइब्रेरी। यह इस्तेमाल में बहुत आसान है। और स्वचालित रूप से सभी इकाइयों के राज्यों को परिभाषित करता है और धाराप्रवाह वाक्यविन्यास का उपयोग करता है। –