public virtual GOUserDataObject LoadUser(Parameters parameters, bool skipSecurity = false) { var user = GetUser(allowLazyLoading: false); if (user != null) { return(user); } user = (GOUserDataObject)ObjectsDataSet.GetObject(new GOUserDataObject(this.GOUserId) { IsNew = false }); if (user == null && !__userCurrentLoading) { __userCurrentLoading = true; user = ApplicationSettings.Container.Resolve <IDataProvider <GOUserDataObject> >().Get(new GOUserDataObject(this.GOUserId), parameters: parameters, skipSecurity: skipSecurity); SetUserValue(user, false, false); __userCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(user == null ? null : ObjectsDataSet.GetObject(user)); }
public virtual GOUserDataObject GetUser(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } GOUserDataObject user; if (_user_NewObjectId != null) { user = (GOUserDataObject)ObjectsDataSet.GetObject(new GOUserDataObject() { IsNew = true, InternalObjectId = _user_NewObjectId }); } else { user = (GOUserDataObject)ObjectsDataSet.GetObject(new GOUserDataObject(this.GOUserId) { IsNew = false }); if (allowLazyLoading && user == null && LazyLoadingEnabled) { user = LoadUser(); } } return(user); }
public virtual GOUserDataObject LoadGOUser(Parameters parameters, bool skipSecurity = false) { if (this.ObjectsDataSet == null) { _logEngine.LogError("Unable to Load Related Data", "Unable to Load Related Data GOUser for the current entity. The DataObjects doesn't have an ObjectsDataSet", "UserProfileObjectsDataSet", null); throw new PulpException("Unable to Load Related Data. The current Data Object doesn't have an ObjectsDataSet"); } var gOUser = (this.ObjectsDataSet as ObjectsDataSet).GOUserObjects == null ? null : (this.ObjectsDataSet as ObjectsDataSet).GOUserObjects.Where(item => item.Value.UserName == Uri).SingleOrDefault().Value; // If null relation => load the entity if (ReferenceEquals(gOUser, null) && !__gOUserCurrentLoading) { __gOUserCurrentLoading = true; var filterPredicate = "UserName == \"" + Uri + "\""; gOUser = ApplicationSettings.Container.Resolve <IDataProvider <GOUserDataObject> >().GetCollection(null, filterPredicate, parameters: parameters, skipSecurity: skipSecurity).SingleOrDefault(); SetGOUserValue(gOUser, false, false); __gOUserCurrentLoading = false; } // Patch for what is most likely an internal dataset fault when the relation field is on PK side of a OneToOne relation // If we've got a gOUser, but relation field not set, encourage it to get set by removing and re-adding the gOUser if (gOUser != null && this.GOUser == null) { this.ObjectsDataSet.RemoveObject(gOUser); this.ObjectsDataSet.AddObject(gOUser); } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(gOUser == null ? null : ObjectsDataSet.GetObject(gOUser)); }
public virtual GORoleDataObject LoadRole(Parameters parameters, bool skipSecurity = false) { var role = GetRole(allowLazyLoading: false); if (role != null) { return(role); } role = (GORoleDataObject)ObjectsDataSet.GetObject(new GORoleDataObject(this.GORoleName) { IsNew = false }); if (role == null && !__roleCurrentLoading) { __roleCurrentLoading = true; role = ApplicationSettings.Container.Resolve <IDataProvider <GORoleDataObject> >().Get(new GORoleDataObject(this.GORoleName), parameters: parameters, skipSecurity: skipSecurity); SetRoleValue(role, false, false); __roleCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(role == null ? null : ObjectsDataSet.GetObject(role)); }
public virtual GOGroupDataObject LoadGroup(Parameters parameters, bool skipSecurity = false) { var group = GetGroup(allowLazyLoading: false); if (group != null) { return(group); } group = (GOGroupDataObject)ObjectsDataSet.GetObject(new GOGroupDataObject(this.GOGroupName) { IsNew = false }); if (group == null && !__groupCurrentLoading) { __groupCurrentLoading = true; group = ApplicationSettings.Container.Resolve <IDataProvider <GOGroupDataObject> >().Get(new GOGroupDataObject(this.GOGroupName), parameters: parameters, skipSecurity: skipSecurity); SetGroupValue(group, false, false); __groupCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(group == null ? null : ObjectsDataSet.GetObject(group)); }
public virtual LocationDataObject LoadLocation(Parameters parameters, bool skipSecurity = false) { var location = GetLocation(allowLazyLoading: false); if (location != null) { return(location); } location = (LocationDataObject)ObjectsDataSet.GetObject(new LocationDataObject(this.LocationURI) { IsNew = false }); if (location == null && !__locationCurrentLoading) { __locationCurrentLoading = true; location = ApplicationSettings.Container.Resolve <IDataProvider <LocationDataObject> >().Get(new LocationDataObject(this.LocationURI), parameters: parameters, skipSecurity: skipSecurity); SetLocationValue(location, false, false); __locationCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(location == null ? null : ObjectsDataSet.GetObject(location)); }
public virtual CountryDataObject LoadCountry(Parameters parameters, bool skipSecurity = false) { var country = GetCountry(allowLazyLoading: false); if (country != null) { return(country); } if (this.CountryURI == null) { return(null); } country = (CountryDataObject)ObjectsDataSet.GetObject(new CountryDataObject((System.String) this.CountryURI) { IsNew = false }); if (country == null && !__countryCurrentLoading) { __countryCurrentLoading = true; country = ApplicationSettings.Container.Resolve <IDataProvider <CountryDataObject> >().Get(new CountryDataObject((System.String) this.CountryURI), parameters: parameters, skipSecurity: skipSecurity); SetCountryValue(country, false, false); __countryCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(country == null ? null : ObjectsDataSet.GetObject(country)); }
public virtual PlaceDataObject LoadPlace(Parameters parameters, bool skipSecurity = false) { var place = GetPlace(allowLazyLoading: false); if (place != null) { return(place); } place = (PlaceDataObject)ObjectsDataSet.GetObject(new PlaceDataObject(this.PlaceURI) { IsNew = false }); if (place == null && !__placeCurrentLoading) { __placeCurrentLoading = true; place = ApplicationSettings.Container.Resolve <IDataProvider <PlaceDataObject> >().Get(new PlaceDataObject(this.PlaceURI), parameters: parameters, skipSecurity: skipSecurity); SetPlaceValue(place, false, false); __placeCurrentLoading = false; } // Return the object was added to our dataset, not the 'temporary' instance that was loaded via the Get() return(place == null ? null : ObjectsDataSet.GetObject(place)); }
public virtual void SetGOUserValue(GOUserDataObject valueToSet, bool notifyChanges, bool dirtyHandlerOn) { var _relatedObjects = ObjectsDataSet.GetRelatedObjects <GOUserDataObject>(this, "GOUser"); var existing_gOUser = _relatedObjects == null ? null : _relatedObjects.SingleOrDefault(); // Give opportunity to change value before set OnBeforeSetRelationField("GOUser", valueToSet); if (!ReferenceEquals(null, valueToSet)) { ObjectsDataSet.AddObjectIfDoesNotExist(valueToSet); if (this.IsNew) { valueToSet._userProfile_NewObjectId = this.InternalObjectId; } else { // Sync the one-to-one association from the FK side valueToSet = ObjectsDataSet.GetObject(valueToSet); valueToSet.UserProfile = this; valueToSet.UserName = this.Uri; } } else if (existing_gOUser != null) { ObjectsDataSet.RemoveObject(existing_gOUser); } if (!ReferenceEquals(existing_gOUser, valueToSet)) { OnPropertyChanged("GOUser", notifyChanges, dirtyHandlerOn); } }
public virtual DataObjectCollection<GOUserGroupDataObject> GetUserGroupItems(bool allowLazyLoading) { if (ObjectsDataSet == null) return null; // Lazy loading enabled and collection not yet loaded => load the collection if (allowLazyLoading && LazyLoadingEnabled && !__userGroupItemsAlreadyLazyLoaded) { LoadUserGroupItems(); } var userGroupItems = ObjectsDataSet.GetRelatedObjects<GOUserGroupDataObject>(this, "UserGroupItems"); userGroupItems.CollectionChanged += new NotifyCollectionChangedEventHandler(UserGroupItems_CollectionChanged); return userGroupItems; }
public virtual DataObjectCollection <GOGroupRoleDataObject> GetGroupRoleItems(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } // Lazy loading enabled and collection not yet loaded => load the collection if (allowLazyLoading && LazyLoadingEnabled && !__groupRoleItemsAlreadyLazyLoaded) { LoadGroupRoleItems(); } var groupRoleItems = ObjectsDataSet.GetRelatedObjects <GOGroupRoleDataObject>(this, "GroupRoleItems"); groupRoleItems.CollectionChanged += new NotifyCollectionChangedEventHandler(GroupRoleItems_CollectionChanged); return(groupRoleItems); }
public virtual DataObjectCollection <PlaceToLocationDataObject> GetPlaceToLocationItems(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } // Lazy loading enabled and collection not yet loaded => load the collection if (allowLazyLoading && LazyLoadingEnabled && !__placeToLocationItemsAlreadyLazyLoaded) { LoadPlaceToLocationItems(); } var placeToLocationItems = ObjectsDataSet.GetRelatedObjects <PlaceToLocationDataObject>(this, "PlaceToLocationItems"); placeToLocationItems.CollectionChanged += new NotifyCollectionChangedEventHandler(PlaceToLocationItems_CollectionChanged); return(placeToLocationItems); }
public virtual DataObjectCollection <VisitedPlaceDataObject> GetVisitedPlaceItems(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } // Lazy loading enabled and collection not yet loaded => load the collection if (allowLazyLoading && LazyLoadingEnabled && !__visitedPlaceItemsAlreadyLazyLoaded) { LoadVisitedPlaceItems(); } var visitedPlaceItems = ObjectsDataSet.GetRelatedObjects <VisitedPlaceDataObject>(this, "VisitedPlaceItems"); visitedPlaceItems.CollectionChanged += new NotifyCollectionChangedEventHandler(VisitedPlaceItems_CollectionChanged); return(visitedPlaceItems); }
public virtual PlaceDataObject GetPlace(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } PlaceDataObject place; if (_place_NewObjectId != null) { place = (PlaceDataObject)ObjectsDataSet.GetObject(new PlaceDataObject() { IsNew = true, InternalObjectId = _place_NewObjectId }); } else { if (this.PlaceURI == null) { return(null); } if (PlaceURI == null) { place = null; } else { place = (PlaceDataObject)ObjectsDataSet.GetObject(new PlaceDataObject((System.String) this.PlaceURI) { IsNew = false }); } if (allowLazyLoading && place == null && LazyLoadingEnabled) { place = LoadPlace(); } } return(place); }
public virtual CountryDataObject GetCountry(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } CountryDataObject country; if (_country_NewObjectId != null) { country = (CountryDataObject)ObjectsDataSet.GetObject(new CountryDataObject() { IsNew = true, InternalObjectId = _country_NewObjectId }); } else { if (this.CountryURI == null) { return(null); } if (CountryURI == null) { country = null; } else { country = (CountryDataObject)ObjectsDataSet.GetObject(new CountryDataObject((System.String) this.CountryURI) { IsNew = false }); } if (allowLazyLoading && country == null && LazyLoadingEnabled) { country = LoadCountry(); } } return(country); }
public virtual GOUserDataObject GetGOUser(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } GOUserDataObject gOUser; { var _relatedObjects = ObjectsDataSet.GetRelatedObjects <GOUserDataObject>(this, "GOUser"); gOUser = _relatedObjects == null ? null : _relatedObjects.SingleOrDefault(); if (allowLazyLoading && gOUser == null && LazyLoadingEnabled) { gOUser = LoadGOUser(); } } return(gOUser); }
public virtual LocationDataObject GetLocation(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } LocationDataObject location; if (_location_NewObjectId != null) { location = (LocationDataObject)ObjectsDataSet.GetObject(new LocationDataObject() { IsNew = true, InternalObjectId = _location_NewObjectId }); } else { if (LocationURI == null) { location = null; } else { location = (LocationDataObject)ObjectsDataSet.GetObject(new LocationDataObject(this.LocationURI) { IsNew = false }); } if (allowLazyLoading && location == null && LazyLoadingEnabled) { location = LoadLocation(); } } return(location); }
public virtual GORoleDataObject GetRole(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } GORoleDataObject role; if (_role_NewObjectId != null) { role = (GORoleDataObject)ObjectsDataSet.GetObject(new GORoleDataObject() { IsNew = true, InternalObjectId = _role_NewObjectId }); } else { if (GORoleName == null) { role = null; } else { role = (GORoleDataObject)ObjectsDataSet.GetObject(new GORoleDataObject(this.GORoleName) { IsNew = false }); } if (allowLazyLoading && role == null && LazyLoadingEnabled) { role = LoadRole(); } } return(role); }
public virtual GOGroupDataObject GetGroup(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } GOGroupDataObject group; if (_group_NewObjectId != null) { group = (GOGroupDataObject)ObjectsDataSet.GetObject(new GOGroupDataObject() { IsNew = true, InternalObjectId = _group_NewObjectId }); } else { if (GOGroupName == null) { group = null; } else { group = (GOGroupDataObject)ObjectsDataSet.GetObject(new GOGroupDataObject(this.GOGroupName) { IsNew = false }); } if (allowLazyLoading && group == null && LazyLoadingEnabled) { group = LoadGroup(); } } return(group); }
public virtual UserProfileDataObject GetUserProfile(bool allowLazyLoading) { if (ObjectsDataSet == null) { return(null); } UserProfileDataObject userProfile; if (_userProfile_NewObjectId != null) { userProfile = (UserProfileDataObject)ObjectsDataSet.GetObject(new UserProfileDataObject() { IsNew = true, InternalObjectId = _userProfile_NewObjectId }); } else { if (UserProfileUri == null) { userProfile = null; } else { userProfile = (UserProfileDataObject)ObjectsDataSet.GetObject(new UserProfileDataObject(this.UserProfileUri) { IsNew = false }); } if (allowLazyLoading && userProfile == null && LazyLoadingEnabled) { userProfile = LoadUserProfile(); } } return(userProfile); }
public GOLoginHistoryObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public virtual void SetPlaceValue(PlaceDataObject valueToSet, bool notifyChanges, bool dirtyHandlerOn) { PlaceDataObject existing_place = null; if (!(this.PlaceURI == null || ObjectsDataSet == null)) { var key = this._place_NewObjectId == null ? new PlaceDataObject(this.PlaceURI) { IsNew = false } : new PlaceDataObject() { IsNew = true, InternalObjectId = this._place_NewObjectId }; existing_place = (PlaceDataObject)ObjectsDataSet.GetObject(key); } if (ReferenceEquals(existing_place, valueToSet)) { return; } // Give opportunity to change value before set OnBeforeSetRelationField("Place", valueToSet); // Setting the navigator desync the FK. The FK should be resync if (!ReferenceEquals(null, valueToSet)) { if (ObjectsDataSet == null) { _logEngine.LogError("Unable to set Relation Field", "Unable to set Relation Field, your entity doesn't have a DataSet.", "PlaceToLocationDataObject", null); throw new PulpException("Unable to set Relation fields, your entity doesn't have a DataSet"); } ObjectsDataSet.AddObjectIfDoesNotExist(valueToSet); if (valueToSet.IsNew) { if (_place_NewObjectId != valueToSet.InternalObjectId) { _place_NewObjectId = valueToSet.InternalObjectId; _placeURI = valueToSet.URI; OnPropertyChanged("PlaceURI", notifyChanges, dirtyHandlerOn); } } else { if (_placeURI != valueToSet.URI) { _place_NewObjectId = null; _placeURI = valueToSet.URI; OnPropertyChanged("PlaceURI", notifyChanges, dirtyHandlerOn); } } } else { _placeURI = null; OnPropertyChanged("PlaceURI", notifyChanges, dirtyHandlerOn); } if (!ReferenceEquals(existing_place, valueToSet)) { OnPropertyChanged("Place", notifyChanges, dirtyHandlerOn); } }
public VisitedPlaceObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public virtual void SetGroupValue(GOGroupDataObject valueToSet, bool notifyChanges, bool dirtyHandlerOn) { GOGroupDataObject existing_group = null; if (!(this.GOGroupName == null || ObjectsDataSet == null)) { var key = this._group_NewObjectId == null ? new GOGroupDataObject(this.GOGroupName) { IsNew = false } : new GOGroupDataObject() { IsNew = true, InternalObjectId = this._group_NewObjectId }; existing_group = (GOGroupDataObject)ObjectsDataSet.GetObject(key); } if (ReferenceEquals(existing_group, valueToSet)) { return; } // Give opportunity to change value before set OnBeforeSetRelationField("Group", valueToSet); // Setting the navigator desync the FK. The FK should be resync if (!ReferenceEquals(null, valueToSet)) { if (ObjectsDataSet == null) { _logEngine.LogError("Unable to set Relation Field", "Unable to set Relation Field, your entity doesn't have a DataSet.", "GOGroupRoleDataObject", null); throw new PulpException("Unable to set Relation fields, your entity doesn't have a DataSet"); } ObjectsDataSet.AddObjectIfDoesNotExist(valueToSet); if (valueToSet.IsNew) { if (_group_NewObjectId != valueToSet.InternalObjectId) { _group_NewObjectId = valueToSet.InternalObjectId; _gOGroupName = valueToSet.Name; OnPropertyChanged("GOGroupName", notifyChanges, dirtyHandlerOn); } } else { if (_gOGroupName != valueToSet.Name) { _group_NewObjectId = null; _gOGroupName = valueToSet.Name; OnPropertyChanged("GOGroupName", notifyChanges, dirtyHandlerOn); } } } else { _gOGroupName = null; OnPropertyChanged("GOGroupName", notifyChanges, dirtyHandlerOn); } if (!ReferenceEquals(existing_group, valueToSet)) { OnPropertyChanged("Group", notifyChanges, dirtyHandlerOn); } }
public UserProfileObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public GOGroupRoleObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public LocationObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public CountryObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public GOUserObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }
public PlaceObjectsDataSet(ObjectsDataSet rootObjectDataSet) { _rootObjectDataSet = rootObjectDataSet; }