//
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 KthParamEntityType
{
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
{
var runtimeEntityType = model.AddEntityType(
"Blink.Backoffice.Services.PcmDb.Entities.KthParam",
typeof(KthParam),
baseEntityType);
var kthParId = runtimeEntityType.AddProperty(
"KthParId",
typeof(decimal),
propertyInfo: typeof(KthParam).GetProperty("KthParId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
valueGenerated: ValueGenerated.OnAdd,
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
kthParId.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));
kthParId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
kthParId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
var centrKthParId = runtimeEntityType.AddProperty(
"CentrKthParId",
typeof(decimal?),
propertyInfo: typeof(KthParam).GetProperty("CentrKthParId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
centrKthParId.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));
centrKthParId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
centrKthParId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var kPWDomyslnaId = runtimeEntityType.AddProperty(
"KPWDomyslnaId",
typeof(decimal?),
propertyInfo: typeof(KthParam).GetProperty("KPWDomyslnaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
kPWDomyslnaId.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));
kPWDomyslnaId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
kPWDomyslnaId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var kolejnosc = runtimeEntityType.AddProperty(
"Kolejnosc",
typeof(short),
propertyInfo: typeof(KthParam).GetProperty("Kolejnosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: (short)0);
kolejnosc.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));
kolejnosc.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var nazwa = runtimeEntityType.AddProperty(
"Nazwa",
typeof(string),
propertyInfo: typeof(KthParam).GetProperty("Nazwa", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).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 wymagany = runtimeEntityType.AddProperty(
"Wymagany",
typeof(short),
propertyInfo: typeof(KthParam).GetProperty("Wymagany", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: (short)0);
wymagany.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));
wymagany.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var key = runtimeEntityType.AddKey(
new[] { kthParId });
runtimeEntityType.SetPrimaryKey(key);
key.AddAnnotation("Relational:Name", "PK_KTHPARAM");
var index = runtimeEntityType.AddIndex(
new[] { kPWDomyslnaId });
return runtimeEntityType;
}
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("KPWDomyslnaId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("KPWId") }),
principalEntityType);
var kPWDomyslna = declaringEntityType.AddNavigation("KPWDomyslna",
runtimeForeignKey,
onDependent: true,
typeof(KthParWartosc),
propertyInfo: typeof(KthParam).GetProperty("KPWDomyslna", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParam).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var kthParam = principalEntityType.AddNavigation("KthParam",
runtimeForeignKey,
onDependent: false,
typeof(ICollection),
propertyInfo: typeof(KthParWartosc).GetProperty("KthParam", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KthParWartosc).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_KTHPARAM_REF_KPDOM_KTHPARWA");
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", "KthParam");
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
Customize(runtimeEntityType);
}
static partial void Customize(RuntimeEntityType runtimeEntityType);
}
}