// using System; 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 ProfilEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "Blink.Backoffice.Services.PcmDb.Entities.Profil", typeof(Profil), baseEntityType); var profilId = runtimeEntityType.AddProperty( "ProfilId", typeof(decimal), propertyInfo: typeof(Profil).GetProperty("ProfilId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); profilId.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)); profilId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); profilId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var aktywny = runtimeEntityType.AddProperty( "Aktywny", typeof(short?), propertyInfo: typeof(Profil).GetProperty("Aktywny", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); aktywny.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))); aktywny.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var nazwa = runtimeEntityType.AddProperty( "Nazwa", typeof(string), propertyInfo: typeof(Profil).GetProperty("Nazwa", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 40, 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(40)", size: 40)); nazwa.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var typ = runtimeEntityType.AddProperty( "Typ", typeof(short), propertyInfo: typeof(Profil).GetProperty("Typ", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).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 utworzony = runtimeEntityType.AddProperty( "Utworzony", typeof(DateTime?), propertyInfo: typeof(Profil).GetProperty("Utworzony", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); utworzony.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)); utworzony.AddAnnotation("Relational:ColumnType", "datetime"); utworzony.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var zmiana = runtimeEntityType.AddProperty( "Zmiana", typeof(DateTime?), propertyInfo: typeof(Profil).GetProperty("Zmiana", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Profil).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[] { profilId }); runtimeEntityType.SetPrimaryKey(key); key.AddAnnotation("Relational:Name", "PK_PROFIL"); return runtimeEntityType; } 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", "Profil"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }