using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Tango.DAL.Remote.DB;
namespace Tango.DAL.Observables
{
[EntityFieldName("@(Model.TableName)")]
public partial class @(Model.Name) : ObservableEntity<@(Model.EntityName)>
{
@foreach (var prop in Model.Fields)
{
private @(prop.Type) _@(prop.Name.ToLower());
///
/// Gets or sets the @(Model.Name.ToLower()) @(prop.Description).
///
[EntityFieldName("@(prop.FieldName)")]
public @(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()
{
Init();
}
///
/// Initializes a new instance of the class.
///
/// The entity.
public @(Model.Name)(@(Model.EntityName) entity) : base(entity)
{
Init();
MapEntityToObservable(entity, this);
}
///
/// Initialize complex types.
///
private void Init()
{
@foreach (var prop in Model.Fields)
{
if (prop.Construct)
{
@(prop.Name) = new @(prop.Type)();
}
}
}
}
}