// using System; using System.Collections.Generic; using System.Reflection; using Blink.Backoffice.Services.PcmDb.Entities; using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable namespace Blink.Backoffice.Services.PcmDb.CompiledEntities { internal partial class ZaleznoscEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "Blink.Backoffice.Services.PcmDb.Entities.Zaleznosc", typeof(Zaleznosc), baseEntityType); var dokId = runtimeEntityType.AddProperty( "DokId", typeof(decimal), propertyInfo: typeof(Zaleznosc).GetProperty("DokId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Zaleznosc).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); dokId.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), keyComparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "numeric(9,0)", precision: 9, scale: 0)); dokId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); dokId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var poprzedniDokId = runtimeEntityType.AddProperty( "PoprzedniDokId", typeof(decimal), propertyInfo: typeof(Zaleznosc).GetProperty("PoprzedniDokId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Zaleznosc).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0m); poprzedniDokId.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), keyComparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, (decimal v) => v.GetHashCode(), (decimal v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "numeric(9,0)", precision: 9, scale: 0)); poprzedniDokId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); poprzedniDokId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( new[] { dokId }); runtimeEntityType.SetPrimaryKey(key); key.AddAnnotation("Relational:Name", "PK_ZALEZNOSC"); var idx_PoprzedniDokId = runtimeEntityType.AddIndex( new[] { poprzedniDokId }, name: "idx_PoprzedniDokId"); return runtimeEntityType; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DokId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("DokId") }), principalEntityType, unique: true, required: true); var dok = declaringEntityType.AddNavigation("Dok", runtimeForeignKey, onDependent: true, typeof(Dok), propertyInfo: typeof(Zaleznosc).GetProperty("Dok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Zaleznosc).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var zaleznoscDok = principalEntityType.AddNavigation("ZaleznoscDok", runtimeForeignKey, onDependent: false, typeof(Zaleznosc), propertyInfo: typeof(Dok).GetProperty("ZaleznoscDok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Dok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "FK_ZALEZNOS_REF_ODDOK_DOK"); return runtimeForeignKey; } public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PoprzedniDokId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("DokId") }), principalEntityType, required: true); var poprzedniDok = declaringEntityType.AddNavigation("PoprzedniDok", runtimeForeignKey, onDependent: true, typeof(Dok), propertyInfo: typeof(Zaleznosc).GetProperty("PoprzedniDok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Zaleznosc).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var zaleznoscPoprzedniDok = principalEntityType.AddNavigation("ZaleznoscPoprzedniDok", runtimeForeignKey, onDependent: false, typeof(ICollection), propertyInfo: typeof(Dok).GetProperty("ZaleznoscPoprzedniDok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Dok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "FK_ZALEZNOS_REF_DODOK_DOK"); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); runtimeEntityType.AddAnnotation("Relational:TableName", "Zaleznosc"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }