One-to-multiple nhing in nhib -- bidirectional Association
The difference between two-way Association and one-way association is that both sides can maintain the relationship. For example, if I query any side of the two sides, the information on the other side can also be queried. If I delete other modifications, I only need to set them, or both. It is embodied in the Code: because the previous one-way Association is on DictionaryEntity, it is necessary to add Association ing to the DictionTypeEntity and its corresponding xml file.
Change DictionaryEntity:
# Region object attributes ////// Type ///Public virtual string Type {get; set ;}////// Type name ///Public virtual string TypeName {get; set ;}////// Timestamp ///Public virtual string TimeStamp {get; set ;}////// Operation user ///Public virtual string AddUser {get; set ;}////// Dictionary Object list set ///Public virtual IList
DictionaryEntitys {get; set;} # endregion
Xml file corresponding to DictionaryEntity:
At this point, if we query the information of DictionaryEntity and want to know the Value of DictionaryTypeEntity, We can query the Value we want in DictionaryEntity. DictionaryType. Value. If we want to save the DictionaryEntity message
You must first instantiate a DictionaryTypeEntity and assign it to DictionaryEntity. DictionaryType. As follows:
DictionaryTypeEntity enDictionaryType=new DictionaryTypeEntity();DictionaryEntity enDictionary=new DictionaryEntity();enDictionary.DictionaryType=enDictionaryType;
In this way, the error "object not instantiated" will not be reported. This is much simpler to avoid the previous joint query.