mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 10:37:55 +08:00
ru
This commit is contained in:
@@ -1,72 +1,72 @@
|
||||
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
|
||||
|
||||
<%@ Assembly Src="Model.cs" %>
|
||||
<%@ Assembly Src="Extensions.cs" %>
|
||||
|
||||
<%@ Import Namespace="System.Collections.Generic" %>
|
||||
<%@ Import Namespace="System.Linq" %>
|
||||
<%@ Import Namespace="System.Text" %>
|
||||
<%@ Import Namespace="System.Text.RegularExpressions" %>
|
||||
|
||||
<%@ Import Namespace="SchemaMapper" %>
|
||||
|
||||
<%@ Property Name="Entity"
|
||||
Type="SchemaMapper.Entity" %>
|
||||
|
||||
<%@ Property Name="EntityNamespace"
|
||||
Type="System.String" %>
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace <%= EntityNamespace %>
|
||||
{
|
||||
/// <summary>
|
||||
/// <%= Entity.Description %>
|
||||
/// </summary>
|
||||
public partial class <%= Entity.ClassName.ToSafeName() %> : Entity
|
||||
{
|
||||
public <%= Entity.ClassName.ToSafeName() %>()
|
||||
{
|
||||
<% foreach(var p in Entity.Properties) {
|
||||
if(p.IsPrimaryKey ==true) continue;
|
||||
string type = p.SystemType.ToNullableType(p.IsNullable == true);
|
||||
if(type =="int" || type=="decimal")
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= 0;");
|
||||
else if(type =="string")
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= string.Empty;");
|
||||
else if(type.ToLower().Contains("datetime"))
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= DateTime.Now;");
|
||||
} // foreach %>
|
||||
<% foreach(var r in Entity.Relationships.Where(e => e.ThisCardinality == Cardinality.Many)) { %>
|
||||
<%= r.ThisPropertyName.ToSafeName() %> = new List<<%= r.OtherEntity.ToSafeName() %>>();
|
||||
<% } // foreach %>
|
||||
}
|
||||
|
||||
<% foreach(var p in Entity.Properties) {
|
||||
if(p.IsPrimaryKey ==true) continue;
|
||||
%>
|
||||
/// <summary>
|
||||
/// <%=p.Description %>
|
||||
/// </summary>
|
||||
public <%= p.SystemType.ToNullableType(p.IsNullable == true) %> <%= p.PropertyName.ToSafeName() %> { get; set; }
|
||||
<% } // foreach %>
|
||||
|
||||
<% foreach(var r in Entity.Relationships) { %>
|
||||
<% if(r.ThisCardinality == Cardinality.Many) { %>
|
||||
public virtual ICollection<<%= r.OtherEntity.ToSafeName() %>> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
|
||||
<% } else { %>
|
||||
public virtual <%= r.OtherEntity.ToSafeName() %> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
|
||||
<% } %>
|
||||
<% } // foreach %>
|
||||
}
|
||||
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
|
||||
|
||||
<%@ Assembly Src="Model.cs" %>
|
||||
<%@ Assembly Src="Extensions.cs" %>
|
||||
|
||||
<%@ Import Namespace="System.Collections.Generic" %>
|
||||
<%@ Import Namespace="System.Linq" %>
|
||||
<%@ Import Namespace="System.Text" %>
|
||||
<%@ Import Namespace="System.Text.RegularExpressions" %>
|
||||
|
||||
<%@ Import Namespace="SchemaMapper" %>
|
||||
|
||||
<%@ Property Name="Entity"
|
||||
Type="SchemaMapper.Entity" %>
|
||||
|
||||
<%@ Property Name="EntityNamespace"
|
||||
Type="System.String" %>
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace <%= EntityNamespace %>
|
||||
{
|
||||
/// <summary>
|
||||
/// <%= Entity.Description %>
|
||||
/// </summary>
|
||||
public partial class <%= Entity.ClassName.ToSafeName() %> : Entity
|
||||
{
|
||||
public <%= Entity.ClassName.ToSafeName() %>()
|
||||
{
|
||||
<% foreach(var p in Entity.Properties) {
|
||||
if(p.IsPrimaryKey ==true) continue;
|
||||
string type = p.SystemType.ToNullableType(p.IsNullable == true);
|
||||
if(type =="int" || type=="decimal")
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= 0;");
|
||||
else if(type =="string")
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= string.Empty;");
|
||||
else if(type.ToLower().Contains("datetime"))
|
||||
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= DateTime.Now;");
|
||||
} // foreach %>
|
||||
<% foreach(var r in Entity.Relationships.Where(e => e.ThisCardinality == Cardinality.Many)) { %>
|
||||
<%= r.ThisPropertyName.ToSafeName() %> = new List<<%= r.OtherEntity.ToSafeName() %>>();
|
||||
<% } // foreach %>
|
||||
}
|
||||
|
||||
<% foreach(var p in Entity.Properties) {
|
||||
if(p.IsPrimaryKey ==true) continue;
|
||||
%>
|
||||
/// <summary>
|
||||
/// <%=p.Description %>
|
||||
/// </summary>
|
||||
public <%= p.SystemType.ToNullableType(p.IsNullable == true) %> <%= p.PropertyName.ToSafeName() %> { get; set; }
|
||||
<% } // foreach %>
|
||||
|
||||
<% foreach(var r in Entity.Relationships) { %>
|
||||
<% if(r.ThisCardinality == Cardinality.Many) { %>
|
||||
public virtual ICollection<<%= r.OtherEntity.ToSafeName() %>> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
|
||||
<% } else { %>
|
||||
public virtual <%= r.OtherEntity.ToSafeName() %> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
|
||||
<% } %>
|
||||
<% } // foreach %>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user