public virtual void Construct(GOGroupRoleDataObject gOGroupRole, bool includeDirtyObjectsOnly) { if (gOGroupRole == null) { return; } this.PrimaryKey = gOGroupRole.PrimaryKeysCollection; if (gOGroupRole.ObjectsDataSet == null) { var dataset = ApplicationSettings.Container.Resolve <IObjectsDataSet>(); dataset.AddObject(gOGroupRole); } if (gOGroupRole.ObjectsDataSet == null) { _logEngine.LogError("Unable to set a dataset to the Entity GOGroupRole", "Unable to set a dataset to the entity. Container may not be initialized", "GOGroupRoleDataObject", null); throw new PulpException("Unexpected Error : Unable to set a dataset to the entity : GOGroupRole"); } if (gOGroupRole.InternalObjectId == null) { _logEngine.LogError("Unable to construct an object without InternalObjectId in GOGroupRoleDataObject", "The Object you are trying to construct doesn't have an InternalObjectId", "GOGroupRoleDataObject", null); throw new PulpException("Unexpected Error : Unable to construct an object without InternalObjectId in GOGroupRoleDataObject"); } this.InternalObjectId = (int)gOGroupRole.InternalObjectId; this.ObjectsDataSet = includeDirtyObjectsOnly ? gOGroupRole.ObjectsDataSet.CloneDirtyObjects() : gOGroupRole.ObjectsDataSet; }
protected void SetRelations(GOGroupRoleDataObject x) { var prefetches = PrefetchAssociations.Get("GOGroupRole", 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); } }
/// <summary> /// Copy Constructor /// </summary> public GOGroupRoleDataObject(GOGroupRoleDataObject template, bool deepCopy) { this.SetGOGroupNameValue(template.GOGroupName, false, false); this.SetGORoleNameValue(template.GORoleName, false, false); this._group_NewObjectId = template._group_NewObjectId; this._role_NewObjectId = template._role_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); }
/// /// 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 GOGroupRoleDataObject(); SetProperties(x); x.IsDirty = x.IsNew = x.IsMarkedForDeletion = false; x.ObjectsDataSet = dataset; x.ObjectsDataSet.AddObjectIfDoesNotExist(x); // Deep-map prefetch relations if (PrefetchAssociations.HasPrefetchForEntity("GOGroupRole", ApplicationSettings.Resolve <IDataProviderTransaction>()?.Parameters)) { SetRelations(x); } return(x); }
public GOGroupRoleContainer(GOGroupRoleDataObject gOGroupRole, bool includeDirtyObjectsOnly) { Construct(gOGroupRole, includeDirtyObjectsOnly); }
public GOGroupRoleContainer(GOGroupRoleDataObject gOGroupRole) { Construct(gOGroupRole, false); }
protected void SetProperties(GOGroupRoleDataObject x) { x.SetGORoleNameValue(this.GORoleName, false, false); x.SetGOGroupNameValue(this.GOGroupName, false, false); }