2024-05-16 10:37:44 +02:00

125 lines
6.1 KiB
C#

// <auto-generated />
using System;
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 KomentarzEntityType
{
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
{
var runtimeEntityType = model.AddEntityType(
"Blink.Backoffice.Services.PcmDb.Entities.Komentarz",
typeof(Komentarz),
baseEntityType);
var zmId = runtimeEntityType.AddProperty(
"ZmId",
typeof(decimal),
propertyInfo: typeof(Komentarz).GetProperty("ZmId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Komentarz).GetField("<ZmId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
afterSaveBehavior: PropertySaveBehavior.Throw,
sentinel: 0m);
zmId.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));
zmId.AddAnnotation("Relational:ColumnType", "numeric(9, 0)");
zmId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var opis = runtimeEntityType.AddProperty(
"Opis",
typeof(string),
propertyInfo: typeof(Komentarz).GetProperty("Opis", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Komentarz).GetField("<Opis>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
maxLength: 255,
unicode: false);
opis.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(255)",
size: 255));
opis.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);
var key = runtimeEntityType.AddKey(
new[] { zmId });
runtimeEntityType.SetPrimaryKey(key);
key.AddAnnotation("Relational:Name", "PK_KOMENTARZ");
return runtimeEntityType;
}
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
{
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ZmId") },
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("ZmId") }),
principalEntityType,
unique: true,
required: true);
var zm = declaringEntityType.AddNavigation("Zm",
runtimeForeignKey,
onDependent: true,
typeof(Zmiana),
propertyInfo: typeof(Komentarz).GetProperty("Zm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Komentarz).GetField("<Zm>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
var komentarz = principalEntityType.AddNavigation("Komentarz",
runtimeForeignKey,
onDependent: false,
typeof(Komentarz),
propertyInfo: typeof(Zmiana).GetProperty("Komentarz", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(Zmiana).GetField("<Komentarz>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
runtimeForeignKey.AddAnnotation("Relational:Name", "FK_KOMENTAR_REF_ZMKOM_ZMIANA");
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", "Komentarz");
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
Customize(runtimeEntityType);
}
static partial void Customize(RuntimeEntityType runtimeEntityType);
}
}