//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Tango Observables Generator
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Do not modify!
//
//------------------------------------------------------------------------------
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;
using Tango.Core;
namespace Tango.BL.Entities
{
@if (Model.Description != null)
{
///
/// @(Model.Description)
///
}
[Table("@(Model.TableName)")]
public partial class @(Model.Name) : ObservableEntity<@(Model.Name)>
{
@foreach (var prop in Model.Fields)
{
if (!prop.Name.EndsWith("Guid"))
{
public event EventHandler<@(prop.Type)> @(prop.Name)Changed;
}
}
@foreach (var prop in Model.Fields)
{
protected @(prop.Type) _@(prop.Name.ToLower());
@if (prop.DbDescription != null)
{
///
@(prop.DbDescription)
///
}
else
{
///
/// 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
{
if (_@(prop.Name.ToLower()) != value)
{
_@(prop.Name.ToLower()) = value;
@if (!prop.Name.EndsWith("Guid"))
{
@(prop.Name)Changed?.Invoke(this, 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)();
}
}
}
}
}