public static int Add(int seriesId, int season) { var entity = new SeasonEntity { SeasonNumber = season, SeriesId = seriesId }; var filter = new PredicateExpression { SeasonFields.SeriesId == seriesId, SeasonFields.SeasonNumber == season }; return Database.AddOrUpdateEntity(entity, filter, false).SeasonId; }
/// <summary> setups the sync logic for member _season</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncSeason(IEntityCore relatedEntity) { if(_season!=relatedEntity) { DesetupSyncSeason(true, true); _season = (SeasonEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _season, new PropertyChangedEventHandler( OnSeasonPropertyChanged ), "Season", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticEpisodeRelations.SeasonEntityUsingSeasonIdStatic, true, new string[] { } ); } }
protected EpisodeEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _artworkToEpisodes = (EntityCollection<ArtworkToEpisodeEntity>)info.GetValue("_artworkToEpisodes", typeof(EntityCollection<ArtworkToEpisodeEntity>)); _episodeToFiles = (EntityCollection<EpisodeToFileEntity>)info.GetValue("_episodeToFiles", typeof(EntityCollection<EpisodeToFileEntity>)); _roleToEpisodes = (EntityCollection<RoleToEpisodeEntity>)info.GetValue("_roleToEpisodes", typeof(EntityCollection<RoleToEpisodeEntity>)); _season = (SeasonEntity)info.GetValue("_season", typeof(SeasonEntity)); if(_season!=null) { _season.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> Removes the sync logic for member _season</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 DesetupSyncSeason(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _season, new PropertyChangedEventHandler( OnSeasonPropertyChanged ), "Season", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticEpisodeRelations.SeasonEntityUsingSeasonIdStatic, true, signalRelatedEntity, "Episodes", resetFKFields, new int[] { (int)EpisodeFieldIndex.SeasonId } ); _season = null; }
protected ArtworkToSeasonEntity(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); } _season = (SeasonEntity)info.GetValue("_season", typeof(SeasonEntity)); if(_season!=null) { _season.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }