/// <summary> setups the sync logic for member _person</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncPerson(IEntityCore relatedEntity) { if(_person!=relatedEntity) { DesetupSyncPerson(true, true); _person = (PersonEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _person, new PropertyChangedEventHandler( OnPersonPropertyChanged ), "Person", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticRoleRelations.PersonEntityUsingPersonIdStatic, true, new string[] { } ); } }
/// <summary> Removes the sync logic for member _person</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncPerson(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _person, new PropertyChangedEventHandler( OnPersonPropertyChanged ), "Person", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticRoleRelations.PersonEntityUsingPersonIdStatic, true, signalRelatedEntity, "Roles", resetFKFields, new int[] { (int)RoleFieldIndex.PersonId } ); _person = null; }
protected ArtworkToPersonEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _artwork = (ArtworkEntity)info.GetValue("_artwork", typeof(ArtworkEntity)); if(_artwork!=null) { _artwork.AfterSave+=new EventHandler(OnEntityAfterSave); } _person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity)); if(_person!=null) { _person.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
protected RoleEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _artworkToRoles = (EntityCollection<ArtworkToRoleEntity>)info.GetValue("_artworkToRoles", typeof(EntityCollection<ArtworkToRoleEntity>)); _roleToEpisodes = (EntityCollection<RoleToEpisodeEntity>)info.GetValue("_roleToEpisodes", typeof(EntityCollection<RoleToEpisodeEntity>)); _roleToSeasons = (EntityCollection<RoleToSeasonEntity>)info.GetValue("_roleToSeasons", typeof(EntityCollection<RoleToSeasonEntity>)); _roleToSeries = (EntityCollection<RoleToSeriesEntity>)info.GetValue("_roleToSeries", typeof(EntityCollection<RoleToSeriesEntity>)); _person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity)); if(_person!=null) { _person.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
public static int AddOrUpdate(string imdbId, string firstName, string lastName, string fullName) { var entity = new PersonEntity { Imdbid = imdbId, FirstName = firstName, LastName = lastName, FullName = fullName }; return Database.AddOrUpdateEntity(entity, new PredicateExpression(PersonFields.Imdbid == imdbId), false).PersonId; }