2024-07-01 21:28:20 +02:00

303 lines
18 KiB
C#

// <auto-generated />
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 StanZgodyEntityType
{
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
{
var runtimeEntityType = model.AddEntityType(
"DuSoft.PcmDb.Entities.StanZgody",
typeof(StanZgody),
baseEntityType);
var kontrId = runtimeEntityType.AddProperty(
"KontrId",
typeof(decimal),
propertyInfo: typeof(StanZgody).GetProperty("KontrId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<KontrId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
kontrId.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone(
comparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
keyComparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
providerValueComparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "numeric(9,0)",
precision: 9,
scale: 0));
kontrId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
kontrId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var zgId = runtimeEntityType.AddProperty(
"ZgId",
typeof(decimal),
propertyInfo: typeof(StanZgody).GetProperty("ZgId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<ZgId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
zgId.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone(
comparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
keyComparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
providerValueComparer: new ValueComparer<decimal>(
(decimal v1, decimal v2) => v1 == v2,
(decimal v) => v.GetHashCode(),
(decimal v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "numeric(9,0)",
precision: 9,
scale: 0));
zgId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
zgId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var dataDec = runtimeEntityType.AddProperty(
"DataDec",
typeof(DateTime?),
propertyInfo: typeof(StanZgody).GetProperty("DataDec", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<DataDec>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
dataDec.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone(
comparer: new ValueComparer<DateTime?>(
(Nullable<DateTime> v1, Nullable<DateTime> v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<DateTime> v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0,
(Nullable<DateTime> v) => v.HasValue ? (Nullable<DateTime>)(DateTime)v : default(Nullable<DateTime>)),
keyComparer: new ValueComparer<DateTime?>(
(Nullable<DateTime> v1, Nullable<DateTime> v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<DateTime> v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0,
(Nullable<DateTime> v) => v.HasValue ? (Nullable<DateTime>)(DateTime)v : default(Nullable<DateTime>)),
providerValueComparer: new ValueComparer<DateTime?>(
(Nullable<DateTime> v1, Nullable<DateTime> v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<DateTime> v) => v.HasValue ? ((DateTime)v).GetHashCode() : 0,
(Nullable<DateTime> v) => v.HasValue ? (Nullable<DateTime>)(DateTime)v : default(Nullable<DateTime>)),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "datetime",
dbType: System.Data.DbType.DateTime));
dataDec.AddAnnotation("Relational:ColumnType", "datetime");
dataDec.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var formaDec = runtimeEntityType.AddProperty(
"FormaDec",
typeof(short?),
propertyInfo: typeof(StanZgody).GetProperty("FormaDec", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<FormaDec>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true);
formaDec.TypeMapping = SqlServerShortTypeMapping.Default.Clone(
comparer: new ValueComparer<short?>(
(Nullable<short> v1, Nullable<short> v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<short> v) => v.HasValue ? (int)(short)v : 0,
(Nullable<short> v) => v.HasValue ? (Nullable<short>)(short)v : default(Nullable<short>)),
keyComparer: new ValueComparer<short?>(
(Nullable<short> v1, Nullable<short> v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<short> v) => v.HasValue ? (int)(short)v : 0,
(Nullable<short> v) => v.HasValue ? (Nullable<short>)(short)v : default(Nullable<short>)),
providerValueComparer: new ValueComparer<short?>(
(Nullable<short> v1, Nullable<short> v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue,
(Nullable<short> v) => v.HasValue ? (int)(short)v : 0,
(Nullable<short> v) => v.HasValue ? (Nullable<short>)(short)v : default(Nullable<short>)));
formaDec.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var kiedy = runtimeEntityType.AddProperty(
"Kiedy",
typeof(string),
propertyInfo: typeof(StanZgody).GetProperty("Kiedy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Kiedy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
maxLength: 20,
unicode: false);
kiedy.TypeMapping = SqlServerStringTypeMapping.Default.Clone(
comparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
keyComparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
providerValueComparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "varchar(20)",
size: 20));
kiedy.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var status = runtimeEntityType.AddProperty(
"Status",
typeof(short),
propertyInfo: typeof(StanZgody).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: (short)0);
status.TypeMapping = SqlServerShortTypeMapping.Default.Clone(
comparer: new ValueComparer<short>(
(short v1, short v2) => v1 == v2,
(short v) => (int)v,
(short v) => v),
keyComparer: new ValueComparer<short>(
(short v1, short v2) => v1 == v2,
(short v) => (int)v,
(short v) => v),
providerValueComparer: new ValueComparer<short>(
(short v1, short v2) => v1 == v2,
(short v) => (int)v,
(short v) => v));
status.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var wersja = runtimeEntityType.AddProperty(
"Wersja",
typeof(string),
propertyInfo: typeof(StanZgody).GetProperty("Wersja", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Wersja>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
nullable: true,
maxLength: 20,
unicode: false);
wersja.TypeMapping = SqlServerStringTypeMapping.Default.Clone(
comparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
keyComparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
providerValueComparer: new ValueComparer<string>(
(string v1, string v2) => v1 == v2,
(string v) => v.GetHashCode(),
(string v) => v),
mappingInfo: new RelationalTypeMappingInfo(
storeTypeName: "varchar(20)",
size: 20));
wersja.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var zmiana = runtimeEntityType.AddProperty(
"Zmiana",
typeof(DateTime),
propertyInfo: typeof(StanZgody).GetProperty("Zmiana", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Zmiana>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>(
(DateTime v1, DateTime v2) => v1.Equals(v2),
(DateTime v) => v.GetHashCode(),
(DateTime v) => v),
keyComparer: new ValueComparer<DateTime>(
(DateTime v1, DateTime v2) => v1.Equals(v2),
(DateTime v) => v.GetHashCode(),
(DateTime v) => v),
providerValueComparer: new ValueComparer<DateTime>(
(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[] { kontrId, zgId });
runtimeEntityType.SetPrimaryKey(key);
key.AddAnnotation("Relational:Name", "PK_STANZGODY");
var idx_STZG_ZG = runtimeEntityType.AddIndex(
new[] { zgId },
name: "idx_STZG_ZG");
var idx_STZG_ZMIANA = runtimeEntityType.AddIndex(
new[] { zmiana },
name: "idx_STZG_ZMIANA");
return runtimeEntityType;
}
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("KontrId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("KontrId") }),
principalEntityType,
required: true);
var kontr = declaringEntityType.AddNavigation("Kontr",
runtimeForeignKey,
onDependent: true,
typeof(Kontrahent),
propertyInfo: typeof(StanZgody).GetProperty("Kontr", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Kontr>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var stanZgody = principalEntityType.AddNavigation("StanZgody",
runtimeForeignKey,
onDependent: false,
typeof(ICollection<StanZgody>),
propertyInfo: typeof(Kontrahent).GetProperty("StanZgody", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Kontrahent).GetField("<StanZgody>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_STZG_KTH");
return runtimeForeignKey;
}
public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ZgId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("ZgId") }),
principalEntityType,
required: true);
var zg = declaringEntityType.AddNavigation("Zg",
runtimeForeignKey,
onDependent: true,
typeof(Zgoda),
propertyInfo: typeof(StanZgody).GetProperty("Zg", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(StanZgody).GetField("<Zg>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var stanZgody = principalEntityType.AddNavigation("StanZgody",
runtimeForeignKey,
onDependent: false,
typeof(ICollection<StanZgody>),
propertyInfo: typeof(Zgoda).GetProperty("StanZgody", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Zgoda).GetField("<StanZgody>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_STZG_ZG");
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", "StanZgody");
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
Customize(runtimeEntityType);
}
static partial void Customize(RuntimeEntityType runtimeEntityType);
}
}