using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
using Newtonsoft.Json;
using System.Linq;
using Tango.DAL.Remote.DB;
namespace Tango.BL.Entities
{
[Table("@(Model.TableName)")]
public partial class @(Model.Name) : ObservableEntity<@(Model.Name)>
{
@foreach (var prop in Model.Fields)
{
protected @(prop.Type) _@(prop.Name.ToLower());
///
/// Gets or sets the @(Model.Name.ToLower()) @(prop.Description).
///
@(!prop.Construct && !prop.Complex ? "[Column(\"" + prop.FieldName + "\")]" : "")
@(prop.IsForeignKey ? "[ForeignKey(\"" + prop.ForeignKeyName + "\")]" : "")
@(prop.XmlIgnore ? "[XmlIgnore]" : "")
@(prop.XmlIgnore ? "[JsonIgnore]" : "")
public @(prop.Construct || prop.Complex ? "virtual" : "") @(prop.Type) @(prop.Name)
{
get { return _@(prop.Name.ToLower()); }
set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); }
}
}
///
/// Initializes a new instance of the class.
///
public @(Model.Name)() : base()
{
@foreach (var prop in Model.Fields)
{
if (prop.Construct)
{
@(prop.Name) = new @(prop.Type)();
}
}
}
}
}