Example #1
0
 /// <summary> setups the sync logic for member _genre</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncGenre(IEntityCore relatedEntity)
 {
     if(_genre!=relatedEntity)
     {
         DesetupSyncGenre(true, true);
         _genre = (GenreEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _genre, new PropertyChangedEventHandler( OnGenrePropertyChanged ), "Genre", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticGenreToSeriesRelations.GenreEntityUsingGenreIdStatic, true, new string[] {  } );
     }
 }
Example #2
0
 protected GenreToSeriesEntity(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if(SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _genre = (GenreEntity)info.GetValue("_genre", typeof(GenreEntity));
         if(_genre!=null)
         {
             _genre.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _series = (SeriesEntity)info.GetValue("_series", typeof(SeriesEntity));
         if(_series!=null)
         {
             _series.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
Example #3
0
 /// <summary> Removes the sync logic for member _genre</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 DesetupSyncGenre(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _genre, new PropertyChangedEventHandler( OnGenrePropertyChanged ), "Genre", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticGenreToSeriesRelations.GenreEntityUsingGenreIdStatic, true, signalRelatedEntity, "GenreToSeries", resetFKFields, new int[] { (int)GenreToSeriesFieldIndex.GenreId } );
     _genre = null;
 }
Example #4
0
 public static int GetOrAdd(string name)
 {
     var entity = new GenreEntity { Name = name };
     return Database.AddOrUpdateEntity(entity, new PredicateExpression(GenreFields.Name == name), false).GenreId;
 }