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

177 lines
9.1 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 TowWartoscEntityType
{
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
{
var runtimeEntityType = model.AddEntityType(
"DuSoft.PcmDb.Entities.TowWartosc",
typeof(TowWartosc),
baseEntityType);
var towId = runtimeEntityType.AddProperty(
"TowId",
typeof(decimal),
propertyInfo: typeof(TowWartosc).GetProperty("TowId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(TowWartosc).GetField("<TowId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
towId.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));
towId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
towId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var parId = runtimeEntityType.AddProperty(
"ParId",
typeof(decimal),
propertyInfo: typeof(TowWartosc).GetProperty("ParId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(TowWartosc).GetField("<ParId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
parId.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));
parId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
parId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var wartosc = runtimeEntityType.AddProperty(
"Wartosc",
typeof(int),
propertyInfo: typeof(TowWartosc).GetProperty("Wartosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(TowWartosc).GetField("<Wartosc>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
sentinel: 0);
wartosc.TypeMapping = IntTypeMapping.Default.Clone(
comparer: new ValueComparer<int>(
(int v1, int v2) => v1 == v2,
(int v) => v,
(int v) => v),
keyComparer: new ValueComparer<int>(
(int v1, int v2) => v1 == v2,
(int v) => v,
(int v) => v),
providerValueComparer: new ValueComparer<int>(
(int v1, int v2) => v1 == v2,
(int v) => v,
(int v) => v));
wartosc.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var key = runtimeEntityType.AddKey(
new[] { towId, parId });
runtimeEntityType.SetPrimaryKey(key);
key.AddAnnotation("Relational:Name", "PK_TOWWARTOSC");
var idx_TowWartParIdWart = runtimeEntityType.AddIndex(
new[] { parId, wartosc },
name: "idx_TowWartParIdWart");
return runtimeEntityType;
}
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ParId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("ParId") }),
principalEntityType,
required: true);
var par = declaringEntityType.AddNavigation("Par",
runtimeForeignKey,
onDependent: true,
typeof(Parametr),
propertyInfo: typeof(TowWartosc).GetProperty("Par", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(TowWartosc).GetField("<Par>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var towWartosc = principalEntityType.AddNavigation("TowWartosc",
runtimeForeignKey,
onDependent: false,
typeof(ICollection<TowWartosc>),
propertyInfo: typeof(Parametr).GetProperty("TowWartosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Parametr).GetField("<TowWartosc>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_TOWWARTO_REF_PARTO_PARAMETR");
return runtimeForeignKey;
}
public static RuntimeForeignKey CreateForeignKey2(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(TowWartosc).GetProperty("Tow", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(TowWartosc).GetField("<Tow>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var towWartosc = principalEntityType.AddNavigation("TowWartosc",
runtimeForeignKey,
onDependent: false,
typeof(ICollection<TowWartosc>),
propertyInfo: typeof(Towar).GetProperty("TowWartosc", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Towar).GetField("<TowWartosc>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_TOWWARTO_REF_TOWWA_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", "TowWartosc");
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
Customize(runtimeEntityType);
}
static partial void Customize(RuntimeEntityType runtimeEntityType);
}
}