//
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 KodDodEntityType
{
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
{
var runtimeEntityType = model.AddEntityType(
"Blink.Backoffice.Services.PcmDb.Entities.KodDod",
typeof(KodDod),
baseEntityType);
var towId = runtimeEntityType.AddProperty(
"TowId",
typeof(decimal),
propertyInfo: typeof(KodDod).GetProperty("TowId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).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 kolejnosc = runtimeEntityType.AddProperty(
"Kolejnosc",
typeof(short),
propertyInfo: typeof(KodDod).GetProperty("Kolejnosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
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 ileWKodzie = runtimeEntityType.AddProperty(
"IleWKodzie",
typeof(decimal?),
propertyInfo: typeof(KodDod).GetProperty("IleWKodzie", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
ileWKodzie.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));
ileWKodzie.AddAnnotation("Relational:ColumnType", "decimal(15, 4)");
ileWKodzie.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var kod = runtimeEntityType.AddProperty(
"Kod",
typeof(string),
propertyInfo: typeof(KodDod).GetProperty("Kod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
maxLength: 20,
unicode: false);
kod.TypeMapping = SqlServerStringTypeMapping.Default.Clone(
comparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
keyComparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
providerValueComparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "varchar(20)",
size: 20));
kod.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var kodCentralny = runtimeEntityType.AddProperty(
"KodCentralny",
typeof(short?),
propertyInfo: typeof(KodDod).GetProperty("KodCentralny", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
kodCentralny.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)));
kodCentralny.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var poziomCen = runtimeEntityType.AddProperty(
"PoziomCen",
typeof(short),
propertyInfo: typeof(KodDod).GetProperty("PoziomCen", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: (short)0);
poziomCen.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));
poziomCen.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var prefPLU = runtimeEntityType.AddProperty(
"PrefPLU",
typeof(int),
propertyInfo: typeof(KodDod).GetProperty("PrefPLU", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: 0);
prefPLU.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));
prefPLU.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var skrot = runtimeEntityType.AddProperty(
"Skrot",
typeof(string),
propertyInfo: typeof(KodDod).GetProperty("Skrot", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
maxLength: 120,
unicode: false);
skrot.TypeMapping = SqlServerStringTypeMapping.Default.Clone(
comparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
keyComparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
providerValueComparer: new ValueComparer(
(string l, string r) => string.Equals(l, r, StringComparison.OrdinalIgnoreCase),
(string v) => v == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(v),
(string v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "varchar(120)",
size: 120));
skrot.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var subsysKoduDod = runtimeEntityType.AddProperty(
"SubsysKoduDod",
typeof(string),
propertyInfo: typeof(KodDod).GetProperty("SubsysKoduDod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true,
maxLength: 40,
unicode: false);
subsysKoduDod.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));
subsysKoduDod.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var typKodu = runtimeEntityType.AddProperty(
"TypKodu",
typeof(short?),
propertyInfo: typeof(KodDod).GetProperty("TypKodu", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
typKodu.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)));
typKodu.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var key = runtimeEntityType.AddKey(
new[] { towId, kolejnosc });
runtimeEntityType.SetPrimaryKey(key);
key.AddAnnotation("Relational:Name", "PK_KODDOD");
var idx_KodDodKod = runtimeEntityType.AddIndex(
new[] { kod },
name: "idx_KodDodKod");
var idx_KodDodSkrot = runtimeEntityType.AddIndex(
new[] { skrot },
name: "idx_KodDodSkrot");
return runtimeEntityType;
}
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TowId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("TowId") }),
principalEntityType,
required: true);
var tow = declaringEntityType.AddNavigation("Tow",
runtimeForeignKey,
onDependent: true,
typeof(Towar),
propertyInfo: typeof(KodDod).GetProperty("Tow", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(KodDod).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var kodDod = principalEntityType.AddNavigation("KodDod",
runtimeForeignKey,
onDependent: false,
typeof(ICollection),
propertyInfo: typeof(Towar).GetProperty("KodDod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Towar).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_KODDOD_REF_KODDO_TOWAR");
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", "KodDod");
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
Customize(runtimeEntityType);
}
static partial void Customize(RuntimeEntityType runtimeEntityType);
}
}