// 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 PozCennikDokEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "Blink.Backoffice.Services.PcmDb.Entities.PozCennikDok", typeof(PozCennikDok), baseEntityType); var dokId = runtimeEntityType.AddProperty( "DokId", typeof(decimal), propertyInfo: typeof(PozCennikDok).GetProperty("DokId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).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 towId = runtimeEntityType.AddProperty( "TowId", typeof(decimal), propertyInfo: typeof(PozCennikDok).GetProperty("TowId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); towId.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)); towId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); towId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var sklepId = runtimeEntityType.AddProperty( "SklepId", typeof(decimal), propertyInfo: typeof(PozCennikDok).GetProperty("SklepId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); sklepId.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)); sklepId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); sklepId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var doKiedyPrzyjecie = runtimeEntityType.AddProperty( "DoKiedyPrzyjecie", typeof(DateTime?), propertyInfo: typeof(PozCennikDok).GetProperty("DoKiedyPrzyjecie", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); doKiedyPrzyjecie.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(DateTime)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(DateTime)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(DateTime)v : default(Nullable)), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "datetime", dbType: System.Data.DbType.DateTime)); doKiedyPrzyjecie.AddAnnotation("Relational:ColumnType", "datetime"); doKiedyPrzyjecie.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var przydzial = runtimeEntityType.AddProperty( "Przydzial", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("Przydzial", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); przydzial.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); przydzial.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var rodzaj = runtimeEntityType.AddProperty( "Rodzaj", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("Rodzaj", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); rodzaj.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); rodzaj.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var statusZam = runtimeEntityType.AddProperty( "StatusZam", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("StatusZam", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); statusZam.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); statusZam.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmDoKiedyPrzyjecie = runtimeEntityType.AddProperty( "ZmDoKiedyPrzyjecie", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("ZmDoKiedyPrzyjecie", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); zmDoKiedyPrzyjecie.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); zmDoKiedyPrzyjecie.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmPrzydzial = runtimeEntityType.AddProperty( "ZmPrzydzial", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("ZmPrzydzial", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); zmPrzydzial.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); zmPrzydzial.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmStatusZam = runtimeEntityType.AddProperty( "ZmStatusZam", typeof(short?), propertyInfo: typeof(PozCennikDok).GetProperty("ZmStatusZam", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); zmStatusZam.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(short)v : 0, (Nullable v) => v.HasValue ? (Nullable)(short)v : default(Nullable))); zmStatusZam.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( new[] { dokId, towId, sklepId }); runtimeEntityType.SetPrimaryKey(key); key.AddAnnotation("Relational:Name", "PK_POZCENNIKDOK"); var index = runtimeEntityType.AddIndex( new[] { sklepId }); return runtimeEntityType; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SklepId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("SklepId") }), principalEntityType, required: true); var sklep = declaringEntityType.AddNavigation("Sklep", runtimeForeignKey, onDependent: true, typeof(Sklep), propertyInfo: typeof(PozCennikDok).GetProperty("Sklep", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozCennikDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var pozCennikDok = principalEntityType.AddNavigation("PozCennikDok", runtimeForeignKey, onDependent: false, typeof(ICollection), propertyInfo: typeof(Sklep).GetProperty("PozCennikDok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Sklep).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "FK_PozCennikDokSklep"); 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", "PozCennikDok"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }