protected void SetRelations(GOUserGroupDataObject x) { var prefetches = PrefetchAssociations.Get("GOUserGroup", ApplicationSettings.Resolve <IDataProviderTransaction>()?.Parameters); if (prefetches.Contains("Group") && this.Group != null) { var group = x.ObjectsDataSet.GetObject(new GOGroupDataObject((System.String) this.Group.Name) { IsNew = false }); if (group == null) { group = this.Group.ToDataObject(x.ObjectsDataSet) as GOGroupDataObject; } x.SetGroupValue(group); } if (prefetches.Contains("User") && this.User != null) { var user = x.ObjectsDataSet.GetObject(new GOUserDataObject((System.Guid) this.User.Id) { IsNew = false }); if (user == null) { user = this.User.ToDataObject(x.ObjectsDataSet) as GOUserDataObject; } x.SetUserValue(user); } }
public virtual void Construct(GOUserGroupDataObject gOUserGroup, bool includeDirtyObjectsOnly) { if (gOUserGroup == null) { return; } this.PrimaryKey = gOUserGroup.PrimaryKeysCollection; if (gOUserGroup.ObjectsDataSet == null) { var dataset = ApplicationSettings.Container.Resolve <IObjectsDataSet>(); dataset.AddObject(gOUserGroup); } if (gOUserGroup.ObjectsDataSet == null) { _logEngine.LogError("Unable to set a dataset to the Entity GOUserGroup", "Unable to set a dataset to the entity. Container may not be initialized", "GOUserGroupDataObject", null); throw new PulpException("Unexpected Error : Unable to set a dataset to the entity : GOUserGroup"); } if (gOUserGroup.InternalObjectId == null) { _logEngine.LogError("Unable to construct an object without InternalObjectId in GOUserGroupDataObject", "The Object you are trying to construct doesn't have an InternalObjectId", "GOUserGroupDataObject", null); throw new PulpException("Unexpected Error : Unable to construct an object without InternalObjectId in GOUserGroupDataObject"); } this.InternalObjectId = (int)gOUserGroup.InternalObjectId; this.ObjectsDataSet = includeDirtyObjectsOnly ? gOUserGroup.ObjectsDataSet.CloneDirtyObjects() : gOUserGroup.ObjectsDataSet; }
/// /// Composite PK routings /// /// /// PK-Side one-to-many relations /// /// /// Bridge to DataObject /// public virtual IDataObject ToDataObject(IObjectsDataSet dataset) { var session = NHibernateSessionController.GetCurrentSession(); session.Evict(this); var x = new GOUserGroupDataObject(); SetProperties(x); x.IsDirty = x.IsNew = x.IsMarkedForDeletion = false; x.ObjectsDataSet = dataset; x.ObjectsDataSet.AddObjectIfDoesNotExist(x); // Deep-map prefetch relations if (PrefetchAssociations.HasPrefetchForEntity("GOUserGroup", ApplicationSettings.Resolve <IDataProviderTransaction>()?.Parameters)) { SetRelations(x); } return(x); }
/// <summary> /// Copy Constructor /// </summary> public GOUserGroupDataObject(GOUserGroupDataObject template, bool deepCopy) { this.SetGOGroupNameValue(template.GOGroupName, false, false); this.SetGOUserIdValue(template.GOUserId, false, false); this._group_NewObjectId = template._group_NewObjectId; this._user_NewObjectId = template._user_NewObjectId; this.SetIsNewValue(template.IsNew, false, false); if (deepCopy) { this.ObjectsDataSet = template.ObjectsDataSet.Clone(); // Remove the template object from the dataset this.ObjectsDataSet.RemoveObject(template); // And Replace by the one we're currently constructing this.ObjectsDataSet.AddObject(this); } this.SetIsDirtyValue(template.IsDirty, false, false); this.SetIsMarkedForDeletionValue(template.IsMarkedForDeletion, false, false); }
protected void SetProperties(GOUserGroupDataObject x) { x.SetGOUserIdValue(this.GOUserId, false, false); x.SetGOGroupNameValue(this.GOGroupName, false, false); }
public GOUserGroupContainer(GOUserGroupDataObject gOUserGroup, bool includeDirtyObjectsOnly) { Construct(gOUserGroup, includeDirtyObjectsOnly); }
public GOUserGroupContainer(GOUserGroupDataObject gOUserGroup) { Construct(gOUserGroup, false); }