73 lines
2.4 KiB
Plaintext
73 lines
2.4 KiB
Plaintext
@{
|
|
ModelData modelData = Model;
|
|
SysTableSchemaViewEntity[] sysTableSchemas = modelData.sysTableSchemas;
|
|
NamespaceObject namespaceObject = modelData.NamespaceObject;
|
|
}
|
|
using CloudBuilder.Core.Authorization;
|
|
namespace @namespaceObject.Namespace
|
|
{
|
|
[TypeScript]
|
|
public class @sysTableSchemas[0].TableName.StringToProerty()EntityKey
|
|
{
|
|
@for (var i = 0; i < sysTableSchemas.Length; i++)
|
|
{
|
|
if (@sysTableSchemas[i].Pk > 0)
|
|
{
|
|
<text> public @sysTableSchemas[i].TypeOfName @sysTableSchemas[i].FieldName.StringToProerty() { get; set; }
|
|
</text>
|
|
}
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (this == obj) return true;
|
|
|
|
@sysTableSchemas[0].TableName.StringToProerty()EntityKey pkey = obj as @sysTableSchemas[0].TableName.StringToProerty()EntityKey;
|
|
if (pkey == null) return false;
|
|
|
|
@for (var i = 0; i < sysTableSchemas.Length; i++)
|
|
{
|
|
if (@sysTableSchemas[i].Pk > 0)
|
|
{
|
|
<text> if (@sysTableSchemas[i].FieldName.StringToProerty() != pkey.@sysTableSchemas[i].FieldName.StringToProerty()) return false;
|
|
</text>
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
public override string ToString()
|
|
{
|
|
string declareSql="";
|
|
@{int j = 0;}
|
|
@for (var i = 0; i < sysTableSchemas.Length; i++)
|
|
{
|
|
if (@sysTableSchemas[i].Pk > 0)
|
|
{
|
|
<text> declareSql=declareSql+$"declare @@__tkey_@sysTableSchemas[i].FieldName.StringToProerty()_@j.ToString() varchar(50) select @@__tkey_@sysTableSchemas[i].FieldName.StringToProerty()_@j.ToString() ='{@sysTableSchemas[i].FieldName.StringToProerty()}'; " ;</text>
|
|
j++;
|
|
}
|
|
}
|
|
|
|
return declareSql;
|
|
}
|
|
}
|
|
}
|
|
/* @if (modelData.KeyCount > 0)
|
|
{<text>builder.Entity<@sysTableSchemas[0].TableName.StringToProerty()Entity>().HasKey(c => new {</text>int k = 0;
|
|
for (var i = 0; i < sysTableSchemas.Length; i++)
|
|
{
|
|
if (@sysTableSchemas[i].Pk > 0)
|
|
{
|
|
k++;
|
|
<text> c.@sysTableSchemas[i].FieldName.StringToProerty()</text>if (modelData.KeyCount != k)
|
|
{<text>,</text>}
|
|
|
|
}
|
|
}
|
|
<text>});</text>
|
|
}
|
|
*/
|