Initial commit

This commit is contained in:
2025-02-13 22:10:32 +01:00
commit 3563d783d4
162 changed files with 14738 additions and 0 deletions

89
.templates/Model.cshtml Normal file
View File

@@ -0,0 +1,89 @@
@inherits RazorTemplate<ObjectDefinition>
@using Bring2mind.CodeGen.Cli.Common
@using Bring2mind.CodeGen.Cli.Data
@using Bring2mind.CodeGen.Cli.Razor
@using Microsoft.SqlServer.Management.Smo
@{
}
using System;
using System.Runtime.Serialization;
using DotNetNuke.ComponentModel.DataAnnotations;
namespace @(Settings.RootNameSpace).Models.@(Model.PluralName)
{
[TableName("@Model.Prefix@Model.ModuleQualifier@Model.Name")]
@if (Model.Table.IsTableWithIdColumn())
{
@: [PrimaryKey("@Model.Table.PrimaryKeyParameters()", AutoIncrement = true)]
}
[DataContract]
@if (Model.Scope != "")
{
@: [Scope("@Model.Scope")]
}
public partial class @(Model.SingularName) @if (Model.TableAndView){@: : @(Model.SingularName)Base
}
{
#region .ctor
public @(Model.SingularName)() @if (Model.TableAndView){@: : base()
}
{
}
#endregion
#region Properties
@foreach (Column c in Model.UniqueViewColumns)
{
@:@Raw(Engine.RunCompile("PropertyField.cshtml", c).TrimEnd('\r', '\n'))
}
#endregion
#region Methods
@if (Model.TableAndView)
{
@: public @(Model.SingularName)Base Get@(Model.SingularName)Base()
@: {
@: @(Model.SingularName)Base res = new @(Model.SingularName)Base();
foreach (Column c in Model.TableColumns)
{
@: res.@c.Name = @c.Name;
}
if (Model.HasAuditFields)
{
@: res.CreatedByUserID = CreatedByUserID;
@: res.CreatedOnDate = CreatedOnDate;
@: res.LastModifiedByUserID = LastModifiedByUserID;
@: res.LastModifiedOnDate = LastModifiedOnDate;
}
@: return res;
@: }
}
public @(Model.SingularName) Clone()
{
@(Model.SingularName) res = new @(Model.SingularName)();
@foreach (Column c in Model.TableColumns)
{
@: res.@c.Name = @c.Name;
}
@if (Model.TableAndView)
{
foreach (Column c in Model.UniqueViewColumns)
{
@: res.@c.Name = @c.Name;
}
}
@if (Model.HasAuditFields)
{
@: res.CreatedByUserID = CreatedByUserID;
@: res.CreatedOnDate = CreatedOnDate;
@: res.LastModifiedByUserID = LastModifiedByUserID;
@: res.LastModifiedOnDate = LastModifiedOnDate;
}
return res;
}
#endregion
}
}