public static int AddOrUpdate(ArtworkTypeEnum artworkType, ArtworkSourceEnum artworkSource, string artworkOriginalId, string onlineThumbPath, string onlineFilePath, string colors, bool? hasText, bool? hasSeriesName, int? height, int? width, int? languageId, decimal? rating, int? ratingCount) { var entity = new ArtworkEntity { ArtworkTypeId = (int)artworkType, ArtworkSourceId = (int)artworkSource, ArtworkOriginalId = artworkOriginalId, OnlineThumbPath = onlineThumbPath, OnlineFilePath = onlineFilePath, Colors = colors, HasText = hasText, HasSeriesName = hasSeriesName, Height = height, Width = width, LanguageId = languageId, Rating = rating, RatingCount = ratingCount }; var filter = new PredicateExpression { ArtworkFields.ArtworkSourceId == (int?)artworkSource, ArtworkFields.ArtworkOriginalId == artworkOriginalId }; return Database.AddOrUpdateEntity(entity, filter, false).ArtworkId; }
/// <summary> setups the sync logic for member _artwork</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncArtwork(IEntityCore relatedEntity) { if(_artwork!=relatedEntity) { DesetupSyncArtwork(true, true); _artwork = (ArtworkEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _artwork, new PropertyChangedEventHandler( OnArtworkPropertyChanged ), "Artwork", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticArtworkToRoleRelations.ArtworkEntityUsingArtworkIdStatic, true, new string[] { } ); } }
/// <summary> Removes the sync logic for member _artwork</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 DesetupSyncArtwork(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _artwork, new PropertyChangedEventHandler( OnArtworkPropertyChanged ), "Artwork", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticArtworkToRoleRelations.ArtworkEntityUsingArtworkIdStatic, true, signalRelatedEntity, "ArtworkToRoles", resetFKFields, new int[] { (int)ArtworkToRoleFieldIndex.ArtworkId } ); _artwork = null; }
protected ArtworkToRoleEntity(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); } _role = (RoleEntity)info.GetValue("_role", typeof(RoleEntity)); if(_role!=null) { _role.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }