// using System; using System.Collections.Generic; using System.Reflection; using DuSoft.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 DuSoft.PcmDb.CompiledEntities { internal partial class OplataEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "DuSoft.PcmDb.Entities.Oplata", typeof(Oplata), baseEntityType); var oplataId = runtimeEntityType.AddProperty( "OplataId", typeof(decimal), propertyInfo: typeof(Oplata).GetProperty("OplataId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); oplataId.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)); oplataId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); oplataId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var aktywny = runtimeEntityType.AddProperty( "Aktywny", typeof(short), propertyInfo: typeof(Oplata).GetProperty("Aktywny", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); aktywny.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)); aktywny.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var centrOplataId = runtimeEntityType.AddProperty( "CentrOplataId", typeof(decimal?), propertyInfo: typeof(Oplata).GetProperty("CentrOplataId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); centrOplataId.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: "numeric(9,0)", precision: 9, scale: 0)); centrOplataId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); centrOplataId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var dataDo = runtimeEntityType.AddProperty( "DataDo", typeof(DateTime?), propertyInfo: typeof(Oplata).GetProperty("DataDo", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); dataDo.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)); dataDo.AddAnnotation("Relational:ColumnType", "datetime"); dataDo.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var dataOd = runtimeEntityType.AddProperty( "DataOd", typeof(DateTime?), propertyInfo: typeof(Oplata).GetProperty("DataOd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); dataOd.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)); dataOd.AddAnnotation("Relational:ColumnType", "datetime"); dataOd.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var kBId = runtimeEntityType.AddProperty( "KBId", typeof(decimal?), propertyInfo: typeof(Oplata).GetProperty("KBId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); kBId.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: "numeric(9,0)", precision: 9, scale: 0)); kBId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); kBId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var komentarz = runtimeEntityType.AddProperty( "Komentarz", typeof(string), propertyInfo: typeof(Oplata).GetProperty("Komentarz", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 255, unicode: false); komentarz.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), keyComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varchar(255)", size: 255)); komentarz.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var kwota = runtimeEntityType.AddProperty( "Kwota", typeof(decimal?), propertyInfo: typeof(Oplata).GetProperty("Kwota", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); kwota.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)); kwota.AddAnnotation("Relational:ColumnType", "decimal(15, 4)"); kwota.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var nazwa = runtimeEntityType.AddProperty( "Nazwa", typeof(string), propertyInfo: typeof(Oplata).GetProperty("Nazwa", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 120, unicode: false); nazwa.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), keyComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varchar(120)", size: 120)); nazwa.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var rodzaj = runtimeEntityType.AddProperty( "Rodzaj", typeof(short), propertyInfo: typeof(Oplata).GetProperty("Rodzaj", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); rodzaj.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)); rodzaj.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var stawkaProc = runtimeEntityType.AddProperty( "StawkaProc", typeof(decimal?), propertyInfo: typeof(Oplata).GetProperty("StawkaProc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); stawkaProc.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)); stawkaProc.AddAnnotation("Relational:ColumnType", "decimal(15, 4)"); stawkaProc.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var typ = runtimeEntityType.AddProperty( "Typ", typeof(short), propertyInfo: typeof(Oplata).GetProperty("Typ", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); typ.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)); typ.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmiana = runtimeEntityType.AddProperty( "Zmiana", typeof(DateTime), propertyInfo: typeof(Oplata).GetProperty("Zmiana", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); zmiana.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), (DateTime v) => v.GetHashCode(), (DateTime v) => v), keyComparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), (DateTime v) => v.GetHashCode(), (DateTime v) => v), providerValueComparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), (DateTime v) => v.GetHashCode(), (DateTime v) => v), 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[] { oplataId }); runtimeEntityType.SetPrimaryKey(key); var index = runtimeEntityType.AddIndex( new[] { kBId }); var ixOplata_DataOd = runtimeEntityType.AddIndex( new[] { dataOd, dataDo }, name: "IxOplata_DataOd"); var ixOplata_Zmiana = runtimeEntityType.AddIndex( new[] { zmiana }, name: "IxOplata_Zmiana"); return runtimeEntityType; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("KBId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("KBId") }), principalEntityType); var kB = declaringEntityType.AddNavigation("KB", runtimeForeignKey, onDependent: true, typeof(KontoBankowe), propertyInfo: typeof(Oplata).GetProperty("KB", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Oplata).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var oplata = principalEntityType.AddNavigation("Oplata", runtimeForeignKey, onDependent: false, typeof(ICollection), propertyInfo: typeof(KontoBankowe).GetProperty("Oplata", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(KontoBankowe).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); runtimeForeignKey.AddAnnotation("Relational:Name", "FK_Oplata_KontoBank"); 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", "Oplata"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }