86 lines
2.0 KiB
C#
86 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace APT.Infrastructure.Core
|
|
{
|
|
public class EFModel
|
|
{
|
|
List<EFModelTable> _tables = null;
|
|
|
|
public EFModel()
|
|
{
|
|
_tables = new List<EFModelTable>();
|
|
}
|
|
|
|
public List<EFModelTable> Tables { get { return _tables; } }
|
|
}
|
|
|
|
|
|
public class EFModelTable
|
|
{
|
|
List<EFModelForeignKey> _foreignKeys = null;
|
|
List<EFModelForeignKey> _allForeignKeys = null;
|
|
List<EFModelField> _fields = null;
|
|
|
|
public EFModelTable()
|
|
{
|
|
_foreignKeys = new List<EFModelForeignKey>();
|
|
_fields = new List<EFModelField>();
|
|
_allForeignKeys = new List<EFModelForeignKey>();
|
|
}
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public List<EFModelForeignKey> ForeignKeys { get { return _foreignKeys; } }
|
|
|
|
public List<EFModelField> Fields { get { return _fields; } }
|
|
|
|
public List<EFModelForeignKey> AllForeignKeys { get { return _allForeignKeys; } }
|
|
|
|
}
|
|
|
|
public class EFModelField
|
|
{
|
|
public EFModelField()
|
|
{
|
|
|
|
}
|
|
|
|
public bool IsNull { get; set; }
|
|
public string Name { get; set; }
|
|
public string TypeName { get; set; }
|
|
public Type FieldType { get; set; }
|
|
public PropertyInfo PropertyInfo { get; set; }
|
|
public new string ToString()
|
|
{
|
|
if (string.IsNullOrEmpty(this.Name)) return "EFModelField";
|
|
return this.Name + ":" + this.TypeName;
|
|
}
|
|
}
|
|
|
|
public class EFModelForeignKey
|
|
{
|
|
public EFModelForeignKey()
|
|
{
|
|
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
|
|
public bool IsNull { get; set; }
|
|
public string ForeignFieldName { get; set; }
|
|
public string ForeignNavName { get; set; }
|
|
public string ForeignTableName { get; set; }
|
|
|
|
public dynamic ForeignKey { get; set; }
|
|
public string MasterNavName { get; set; }
|
|
|
|
}
|
|
|
|
|
|
}
|