// 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 RozPrtMagEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "Blink.Backoffice.Services.PcmDb.Entities.RozPrtMag", typeof(RozPrtMag), baseEntityType); var towId = runtimeEntityType.AddProperty( "TowId", typeof(decimal), propertyInfo: typeof(RozPrtMag).GetProperty("TowId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).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 pMId = runtimeEntityType.AddProperty( "PMId", typeof(decimal), propertyInfo: typeof(RozPrtMag).GetProperty("PMId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); pMId.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)); pMId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); pMId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var znaczenie = runtimeEntityType.AddProperty( "Znaczenie", typeof(short), propertyInfo: typeof(RozPrtMag).GetProperty("Znaczenie", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: (short)0); znaczenie.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (short v1, short v2) => v1 == v2, (short v) => (int)v, (short v) => v), keyComparer: new ValueComparer( (short v1, short v2) => v1 == v2, (short v) => (int)v, (short v) => v), providerValueComparer: new ValueComparer( (short v1, short v2) => v1 == v2, (short v) => (int)v, (short v) => v)); znaczenie.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var dokId = runtimeEntityType.AddProperty( "DokId", typeof(decimal), propertyInfo: typeof(RozPrtMag).GetProperty("DokId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).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 kolejnosc = runtimeEntityType.AddProperty( "Kolejnosc", typeof(int), propertyInfo: typeof(RozPrtMag).GetProperty("Kolejnosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); kolejnosc.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v), keyComparer: new ValueComparer( (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v), providerValueComparer: new ValueComparer( (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); kolejnosc.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var dzien = runtimeEntityType.AddProperty( "Dzien", typeof(DateTime?), propertyInfo: typeof(RozPrtMag).GetProperty("Dzien", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); dzien.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)); dzien.AddAnnotation("Relational:ColumnType", "datetime"); dzien.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var iloscPrt = runtimeEntityType.AddProperty( "IloscPrt", typeof(decimal?), propertyInfo: typeof(RozPrtMag).GetProperty("IloscPrt", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); iloscPrt.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((decimal)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(decimal)v : default(Nullable)), keyComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((decimal)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(decimal)v : default(Nullable)), providerValueComparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((decimal)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(decimal)v : default(Nullable)), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "decimal(15,4)", precision: 15, scale: 4)); iloscPrt.AddAnnotation("Relational:ColumnType", "decimal(15, 4)"); iloscPrt.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmiana = runtimeEntityType.AddProperty( "Zmiana", typeof(DateTime?), propertyInfo: typeof(RozPrtMag).GetProperty("Zmiana", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); zmiana.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)); zmiana.AddAnnotation("Relational:ColumnType", "datetime"); zmiana.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( new[] { towId, pMId, znaczenie, dokId, kolejnosc }); runtimeEntityType.SetPrimaryKey(key); key.AddAnnotation("Relational:Name", "PK_ROZPRTMAG"); var idx_RozPrtMagDzien = runtimeEntityType.AddIndex( new[] { dzien }, name: "idx_RozPrtMagDzien"); var idx_RozPrtMagPoz = runtimeEntityType.AddIndex( new[] { dokId, kolejnosc, znaczenie, pMId }, name: "idx_RozPrtMagPoz"); return runtimeEntityType; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DokId"), declaringEntityType.FindProperty("Kolejnosc") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("DokId"), principalEntityType.FindProperty("Kolejnosc") }), principalEntityType, required: true); var pozDok = declaringEntityType.AddNavigation("PozDok", runtimeForeignKey, onDependent: true, typeof(PozDok), propertyInfo: typeof(RozPrtMag).GetProperty("PozDok", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var rozPrtMag = principalEntityType.AddNavigation("RozPrtMag", runtimeForeignKey, onDependent: false, typeof(ICollection), propertyInfo: typeof(PozDok).GetProperty("RozPrtMag", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PozDok).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "Ref_RozPrtMagPoz"); return runtimeForeignKey; } public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TowId"), declaringEntityType.FindProperty("PMId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("TowId"), principalEntityType.FindProperty("PMId") }), principalEntityType, required: true); var prtMag = declaringEntityType.AddNavigation("PrtMag", runtimeForeignKey, onDependent: true, typeof(PrtMag), propertyInfo: typeof(RozPrtMag).GetProperty("PrtMag", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(RozPrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var rozPrtMag = principalEntityType.AddNavigation("RozPrtMag", runtimeForeignKey, onDependent: false, typeof(ICollection), propertyInfo: typeof(PrtMag).GetProperty("RozPrtMag", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PrtMag).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "Ref_RozPrtMagPrt"); 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", "RozPrtMag"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }