// 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 PolitykaEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { var runtimeEntityType = model.AddEntityType( "Blink.Backoffice.Services.PcmDb.Entities.Polityka", typeof(Polityka), baseEntityType); var polId = runtimeEntityType.AddProperty( "PolId", typeof(decimal), propertyInfo: typeof(Polityka).GetProperty("PolId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0m); polId.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)); polId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); polId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var aktywny = runtimeEntityType.AddProperty( "Aktywny", typeof(short), propertyInfo: typeof(Polityka).GetProperty("Aktywny", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).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 centrPolId = runtimeEntityType.AddProperty( "CentrPolId", typeof(decimal?), propertyInfo: typeof(Polityka).GetProperty("CentrPolId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); centrPolId.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)); centrPolId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)"); centrPolId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var nazwa = runtimeEntityType.AddProperty( "Nazwa", typeof(string), propertyInfo: typeof(Polityka).GetProperty("Nazwa", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).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 zastosowanie = runtimeEntityType.AddProperty( "Zastosowanie", typeof(short), propertyInfo: typeof(Polityka).GetProperty("Zastosowanie", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); zastosowanie.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)); zastosowanie.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( new[] { polId }); runtimeEntityType.SetPrimaryKey(key); key.AddAnnotation("Relational:Name", "PK_POLITYKA"); var idx_CentrPolId = runtimeEntityType.AddIndex( new[] { centrPolId }, name: "idx_CentrPolId"); return runtimeEntityType; } public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType declaringEntityType, RuntimeEntityType targetEntityType, RuntimeEntityType joinEntityType) { var skipNavigation = declaringEntityType.AddSkipNavigation( "Mag", targetEntityType, joinEntityType.FindForeignKey( new[] { joinEntityType.FindProperty("PolId") }, declaringEntityType.FindKey(new[] { declaringEntityType.FindProperty("PolId") }), declaringEntityType), true, false, typeof(ICollection), propertyInfo: typeof(Polityka).GetProperty("Mag", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Polityka).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var inverse = targetEntityType.FindSkipNavigation("Pol"); if (inverse != null) { skipNavigation.Inverse = inverse; inverse.Inverse = skipNavigation; } return skipNavigation; } 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", "Polityka"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); } }