初始化

This commit is contained in:
2025-11-25 17:41:24 +08:00
commit 4cdf0f0f85
3383 changed files with 1050962 additions and 0 deletions

43
Face.Domain/App.config Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<connectionStrings>
<add name="AuthorityDBTestEntities" connectionString="metadata=res://*/Entities.permissionModel.csdl|res://*/Entities.permissionModel.ssdl|res://*/Entities.permissionModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.119.147.104;initial catalog=AuthorityDBTest;user id=sa;password=9S844fK3;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="FaceEntitiesShow" connectionString="metadata=res://*/Entities.faceModelShow.csdl|res://*/Entities.faceModelShow.ssdl|res://*/Entities.faceModelShow.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.119.147.104;initial catalog=Face;user id=sa;password=9S844fK3;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="AuthorityDBEntities" connectionString="metadata=res://*/Entities.AuthorityDBModel.csdl|res://*/Entities.AuthorityDBModel.ssdl|res://*/Entities.AuthorityDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.119.147.104;initial catalog=AuthorityDB;user id=sa;password=9S844fK3;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="hfEntities" connectionString="metadata=res://*/Entities.SumInfoModel.csdl|res://*/Entities.SumInfoModel.ssdl|res://*/Entities.SumInfoModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.119.147.104;initial catalog=hf;user id=sa;password=9S844fK3;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="AuthorityDBEntitiesShow" connectionString="metadata=res://*/Entities.AuthorityDBModel.csdl|res://*/Entities.AuthorityDBModel.ssdl|res://*/Entities.AuthorityDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.119.147.104;initial catalog=AuthorityDB;user id=sa;password=9S844fK3;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="blv_rul" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=Face.Domain.Entities.blv_rul;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.29.0" newVersion="8.0.29.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" /></startup></configuration>

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application
{
/// <summary>
/// 数据库连接串实体
/// </summary>
public class DBCofinStrModel
{
/// <summary>
/// iD
/// </summary>
public int ID { get; set; }
/// <summary>
/// 数据库连接串
/// </summary>
public string CofinStr { get; set; }
}
}

View File

@@ -0,0 +1,78 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 入住表
/// </summary>
public class CheckInInfo
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 客户名字
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)")]
public string Name { get; set; }
/// <summary>
/// 身份证
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)",IsNullable =true)]
public string IdNumber { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> CreationTime { get; set; }
/// <summary>
/// 信息来源
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int InfoSource { get; set; }
/// <summary>
/// 酒店code
/// </summary>
[SugarColumn(ColumnDataType = "int",IsNullable =true)]
public Nullable<int> HotelCode { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> Roomid { get; set; }
/// <summary>
/// 开房时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> CheckTime { get; set; }
/// <summary>
/// 退房时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> checkOutTime { get; set; }
/// <summary>
/// 图片
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string picture { get; set; }
/// <summary>
/// 身份
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)", IsNullable = true)]
public string identitys { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 开房测试表
/// </summary>
public class CheckinTest
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 测试状态 0是预开 1是已开 2.已退 3.退房失败 4.开房失败
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> testState { get; set; }
/// <summary>
/// 预计开房时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> predictCheckIn { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> creationTime { get; set; }
/// <summary>
/// 开房时长
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> checkInduration { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> hotelid { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> Roomid { get; set; }
/// <summary>
/// 退房时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> CheckoutTime { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 日常操作表
/// </summary>
public class Dailyoperation
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 操作人
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string Uname { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)")]
public System.DateTime Creationtime { get; set; }
/// <summary>
/// 操作类型
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)",IsNullable =true)]
public string operatetype { get; set; }
/// <summary>
/// 操作数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(200)", IsNullable = true)]
public string operatedata { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int hotelCode { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{/// <summary>
/// 人脸机设备表
/// </summary>
public class DeviceManage
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int Facelid { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)")]
public string SerialNo { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable =true)]
public Nullable<System.DateTime> CreatedDate { get; set; }
/// <summary>
/// 酒店code
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)", IsNullable = true)]
public string HotelCode { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> RoomId { get; set; }
/// <summary>
/// 厂家
/// </summary>
[SugarColumn(ColumnDataType = "varchar(10)", IsNullable = true)]
public string Factory { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDataType = "bit")]
public bool Status { get; set; }
/// <summary>
/// 绑定时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> bindingDate { get; set; }
/// <summary>
/// 绑定状态 1是绑定 0是解绑
/// </summary>
[SugarColumn(ColumnDataType = "bit")]
public bool bindingStatus { get; set; }
/// <summary>
/// ip地址
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string faceIp { get; set; }
/// <summary>
/// 地理位置
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string faceAddress { get; set; }
/// <summary>
/// 维修状态 0是正常 1是故障
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> maintainStatus { get; set; }
}
}

View File

@@ -0,0 +1,55 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 人脸机绑定表
/// </summary>
public class FaceBinding
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int ID { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string SerialNo { get; set; }
/// <summary>
/// 操作人
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)", IsNullable = true)]
public string Operator { get; set; }
/// <summary>
/// 操作类型
/// </summary>
[SugarColumn(ColumnDataType = "bit", IsNullable = true)]
public Nullable<bool> OperatorType { get; set; }
/// <summary>
/// 绑定时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> bindingDate { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> HotelCode { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> RoomId { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 人脸机信息表
/// </summary>
public class FaceInfo
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)")]
public System.DateTime CreationDate { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string SerialNo { get; set; }
/// <summary>
/// 绑定状态
/// </summary>
[SugarColumn(ColumnDataType = "bit")]
public bool BindingState { get; set; }
/// <summary>
/// 绑定时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable =true)]
public Nullable<System.DateTime> BindingDate { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> HotelCode { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> Roomid { get; set; }
/// <summary>
/// 人脸机状态
/// </summary>
[SugarColumn(ColumnDataType = "bit")]
public bool FaceState { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 人脸机流程
/// </summary>
public class FaceIssue
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)")]
public string faceSn { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)")]
public System.DateTime creationtime { get; set; }
/// <summary>
/// pmsid
/// </summary>
[SugarColumn(ColumnDataType = "varchar(200)",IsNullable =true)]
public string pmsid { get; set; }
/// <summary>
/// 图片
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string picture { get; set; }
/// <summary>
/// 下发状态 0是成功 1是失败
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int issuestate { get; set; }
/// <summary>
/// 信息id
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)")]
public string messageid { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 酒店表
/// </summary>
public class Hotel
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int ID { get; set; }
/// <summary>
/// 酒店code
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)")]
public string Code { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string Remark { get; set; }
/// <summary>
/// 是否使用微信
/// </summary>
[SugarColumn(ColumnDataType = "bit")]
public bool UserWX { get; set; }
/// <summary>
/// 酒店ID跟云端对应
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int HotelID { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 入住客人表
/// </summary>
public class Lodger
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int LodgerId { get; set; }
/// <summary>
/// 客户名字
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)")]
public string LodgerNmae { get; set; }
/// <summary>
/// 客户身份证
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)")]
public string IDNumber { get; set; }
/// <summary>
/// 性别 0女 1男
/// </summary>
[SugarColumn(ColumnDataType = "int",IsNullable =true)]
public Nullable<int> Sex { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> CheckInDate { get; set; }
/// <summary>
/// 信息来源 0是人工 1是pms接口
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int Sourcedian { get; set; }
/// <summary>
/// 电话号码
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string phonenumber { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string remark { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 测试用户表
/// </summary>
public class TestUser
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 测试名字
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string name { get; set; }
/// <summary>
/// 性别
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> sex { get; set; }
/// <summary>
/// 电话
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string phone { get; set; }
/// <summary>
/// 身份证
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string idNumber { get; set; }
/// <summary>
/// 图片
/// </summary>
[SugarColumn(ColumnDataType = "varchar(200)", IsNullable = true)]
public string picture { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime", IsNullable = true)]
public Nullable<System.DateTime> creationTime { get; set; }
/// <summary>
/// 状态 0是冻结 1是正常
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> state { get; set; }
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string establish { get; set; }
}
}

View File

@@ -0,0 +1,55 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// 操作日志表
/// </summary>
public class ULog
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 操作人
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)")]
public string Uname { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)")]
public System.DateTime Creationtime { get; set; }
/// <summary>
/// 操作类型
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)")]
public string operatetype { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)",IsNullable =true)]
public string faceSN { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> hotelcode { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> roomid { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
public class devicestatushistory
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int ID { get; set; }
/// <summary>
/// 人脸机串号
/// </summary>
public string SN { get; set; }
/// <summary>
/// 人脸机生产厂家
/// </summary>
public string Factory { get; set; }
/// <summary>
/// 新状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 原因描述
/// </summary>
public string Reason { get; set; }
}
}

View File

@@ -0,0 +1,82 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
public class facedevicerxtxinfo
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> pmsid { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(256)", IsNullable = true)]
public string sn { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(256)", IsNullable = true)]
public string msgid { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string cmd { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(10)", IsNullable = true)]
public string direction { get; set; }
/// <summary>
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> trresult { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(700)", IsNullable = true)]
public string data { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> datatime { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string ipaddr { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(256)", IsNullable = true)]
public string iplocation { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
public class fileawholelog
{
public int id { get; set; }
public string filename { get; set; }
public string md5 { get; set; }
public DateTime creationtime { get; set; }
public int filetype { get; set; }
public int hotelid { get; set; }
public int roomid { get; set; }
public int type { get; set; }
public string remark { get; set; }
public double firmwaresize { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// pms信息
/// </summary>
public class pmsInfo
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int pmsid { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable =true)]
public Nullable<System.DateTime> Creationtime { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(300)")]
public string data { get; set; }
/// <summary>
/// 信息类型 0是退房 1是开房
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> infotype { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> hotelid { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> room { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// pms传输人脸机表
/// </summary>
public class pmsInterface
{
/// <summary>
/// pmsid
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int pmsId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)")]
public System.DateTime DateTime { get; set; }
/// <summary>
/// pms 传输内容
/// </summary>
[SugarColumn(ColumnDataType = "varchar(300)")]
public string pmsContent { get; set; }
/// <summary>
/// 酒店id
/// </summary>
[SugarColumn(ColumnDataType = "int",IsNullable =true)]
public Nullable<int> hotelid { get; set; }
/// <summary>
/// 房间id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> room { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string faceSN { get; set; }
/// <summary>
/// 1是成功 2是失败 3是人脸机不在线 下发结果
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> issueresult { get; set; }
/// <summary>
/// 1是开房 0是退房
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> pmstype { get; set; }
/// <summary>
/// 信息id
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string messageid { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
/// pms日志表
/// </summary>
public class pmsLog
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// pmsid
/// </summary>
[SugarColumn(ColumnDataType = "int")]
public int pmsid { get; set; }
/// <summary>
/// 步骤
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> step { get; set; }
/// <summary>
/// app 1是face 2是console
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> app { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> Creationtime { get; set; }
/// <summary>
/// 说明
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", IsNullable = true)]
public string message { get; set; }
/// <summary>
/// 数据
/// </summary>
[SugarColumn(ColumnDataType = "varchar(500)", IsNullable = true)]
public string Data { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
///
/// </summary>
public class subtabulation
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// 信息id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> masterid { get; set; }
/// <summary>
/// 用户id
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> Lodgerid { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application.FaceAll
{
/// <summary>
///
/// </summary>
public class transferFace
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
/// <summary>
/// SN号
/// </summary>
[SugarColumn(ColumnDataType = "varchar(100)", IsNullable = true)]
public string faceSN { get; set; }
/// <summary>
/// 信息id
/// </summary>
[SugarColumn(ColumnDataType = "varchar(150)", IsNullable = true)]
public string infoid { get; set; }
/// <summary>
/// 故障状态 0是收到 1是正处理 2是失败 3是已成功
/// </summary>
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
public Nullable<int> faultState { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
public Nullable<System.DateTime> creationTime { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
public class NurseScheduleStatisticsModel : DynamicObject
{
public string EmpName { get; set; }
public string TotalHour { get; set; }
public string TotalWork { get; set; }
Dictionary<string, object> Properties = new Dictionary<string, object>();
public override bool TrySetMember(SetMemberBinder binder, object value)
{
if (!Properties.Keys.Contains(binder.Name))
{
//在此可以做一些小动作
//if (binder.Name == "Col")
//  Properties.Add(binder.Name + (Properties.Count), value.ToString());
//else
//  Properties.Add(binder.Name, value.ToString());
Properties.Add(binder.Name, value.ToString());
}
return true;
}
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
return Properties.TryGetValue(binder.Name, out result);
}
}
}

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
/// <summary>
/// 产值查询实体
/// </summary>
public class OutputValueModel
{
public int ID { get; set; }
/// <summary>
/// 订单ID
/// </summary>
public int OrderID { get; set; }
/// <summary>
/// 产线ID
/// </summary>
public int ProductionLineID { get; set; }
/// <summary>
/// 产线名称
/// </summary>
public string ProductionLineName { get; set; }
/// <summary>
/// 生产时间
/// </summary>
public string ProductionTime { get; set; }
/// <summary>
/// 已完成产量
/// </summary>
public int ActualOutput { get; set; }
/// <summary>
/// 价格
/// </summary>
public float Price { get; set; }
/// <summary>
/// 价格
/// </summary>
public float OutputPrice { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
public class Sys_Currency
{
/// <summary>
/// 币种
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 币种名称
/// </summary>
public string CurrencyName { get; set; }
/// <summary>
/// 币种符号
/// </summary>
public string CurrencySymbol { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
public class TBL_Station
{
/// <summary>
/// 站ID
/// </summary>
public int StationID { get; set; }
/// <summary>
/// 站名
/// </summary>
public string StationName { get; set; }
/// <summary>
/// 操作站类型
/// </summary>
public string StationType { get; set; }
/// <summary>
/// 工艺排序
/// </summary>
public int ArtworkOrder { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
public class TBL_QA_TestLog
{
/// <summary>
/// 用户ID
/// </summary>
public int UserID { get; set; }
/// <summary>
/// 序号
/// </summary>
public string DUT_SN { get; set; }
/// <summary>
/// 时间
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// 测试结果
/// </summary>
public bool TestResult { get; set; }
/// <summary>
/// 检测过程
/// </summary>
public string QA_FlowLog { get; set; }
/// <summary>
/// 检测备注
/// </summary>
public string QA_CheckResult { get; set; }
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application
{
/// <summary>
/// 房间 基本信息
/// </summary>
[Table("TBL_ROOM_BASIC_INFO")]
public class TBL_ROOM_BASIC_INFO
{
/// <summary>
/// 自增id
/// </summary>
[Key, Column(TypeName = "int"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ROOM_ID { get; set; }
/// <summary>
/// 酒店编号
/// </summary>
[Required, Column(TypeName = "int"), ]
public int HOTEL_ID { get; set; }
/// <summary>
/// 房型id
/// </summary>
[Required, Column(TypeName = "int")]
public int ROOM_TYPE_ID { get; set; }
public int RoomStatusID { get; set; }
/// <summary>
/// 房间号
/// </summary>
[Required, Column(TypeName = "varchar(20)")]
public string ROOM_NUMBER { get; set; }
/// <summary>
/// 房间描述
/// </summary>
[Column(TypeName = "varchar(200)")]
public string DESCRPTION { get; set; }
/// <summary>
/// RCU_ID TBL_RCU_BASIC_INFO表MAC
/// </summary>
[Column(TypeName = "varchar(50)")]
public string MAC { get; set; }
/// <summary>
/// 记录更新时间
/// </summary>
[Required, Column(TypeName = "datetime")]
public DateTime UPDATE_TIMEMARK { get; set; }
/// <summary>
/// 备注
/// </summary>
[Column(TypeName = "varchar(200)")]
public string REMARK { get; set; }
/// <summary>
/// 房型id 巫工
/// </summary>
[Required, Column(TypeName = "int")]
public int ROOM_TYPE_OLD_ID { get; set; }
/// <summary>
/// 酒店编号 巫工
/// </summary>
[Required, Column(TypeName = "int")]
public int HOTEL_OLD_ID { get; set; }
/// <summary>
/// id 巫工
/// </summary>
[Column(TypeName = "int")]
public int ROOM_OLD_ID { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
/// <summary>
/// 测试记录实体
/// </summary>
public class TBL_TestLog
{
/// <summary>
/// ID
/// </summary>
public int ID { get; set; }
/// <summary>
/// sn号
/// </summary>
public string Tester_SN { get; set; }
/// <summary>
/// 测试结果
/// </summary>
public bool TestResult { get; set; }
/// <summary>
/// 订单ID
/// </summary>
public int OrderID { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain
{
public class ToDayCapacity
{
/// <summary>
/// DUT序号
/// </summary>
public string DUT_SN { get; set; }
/// <summary>
/// 检测时间
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// T5-2检测时间
/// </summary>
public string DateTime_2nd { get; set; }
/// <summary>
/// 检测结果
/// </summary>
public bool TestResult { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application
{
public class UserAdmin
{
public int Id { get; set; }
public string Uid { get; set; }
public string Pwd { get; set; }
public string PwdSee { get; set; }
public string HeadImg { get; set; }
public int Sex { get; set; }
public int Age { get; set; }
public int IsValid { get; set; }
public string Desc { get; set; }
public string CreateTime { get; set; }
public string CreatedBy { get; set; }
public int HotelID { get; set; }
public int HotelGroupID { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face.Domain.Application
{
public class tb_HotelCode
{
public string Code { get; set; }
public string Remark { get; set; }
public bool UserWX { get; set; }
public int HotelID { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class AppAutho
{
public int AppId { get; set; }
public int AuthorityId { get; set; }
public int Id { get; set; }
public System.DateTime CreateTime { get; set; }
public string CreatedBy { get; set; }
public virtual Authority Authority { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class AuthoStatusType
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public AuthoStatusType()
{
this.OrgAuthority = new HashSet<OrgAuthority>();
this.UserAuthoes = new HashSet<UserAuthoes>();
}
public int Id { get; set; }
public string Name { get; set; }
public string Desc { get; set; }
public System.DateTime CreateTime { get; set; }
public string CreatedBy { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<OrgAuthority> OrgAuthority { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<UserAuthoes> UserAuthoes { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Authority
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Authority()
{
this.AppAutho = new HashSet<AppAutho>();
this.OrgAuthority = new HashSet<OrgAuthority>();
this.UserAuthoes = new HashSet<UserAuthoes>();
}
public int Id { get; set; }
public string AuthorityName { get; set; }
public string Desc { get; set; }
public System.DateTime CreateTime { get; set; }
public string CreatedBy { get; set; }
public Nullable<int> IsValid { get; set; }
public string AuthoStatusTypeId { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<AppAutho> AppAutho { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<OrgAuthority> OrgAuthority { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<UserAuthoes> UserAuthoes { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class AuthorityDBEntitiesShow : DbContext
{
public AuthorityDBEntitiesShow()
: base("name=AuthorityDBEntitiesShow")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<C__MigrationHistory> C__MigrationHistory { get; set; }
public virtual DbSet<AppAutho> AppAutho { get; set; }
public virtual DbSet<Authority> Authority { get; set; }
public virtual DbSet<AuthoStatusType> AuthoStatusType { get; set; }
public virtual DbSet<DbLog> DbLog { get; set; }
public virtual DbSet<Hosts> Hosts { get; set; }
public virtual DbSet<HotelGroups> HotelGroups { get; set; }
public virtual DbSet<OrgAuthority> OrgAuthority { get; set; }
public virtual DbSet<TBL_Multilingual> TBL_Multilingual { get; set; }
public virtual DbSet<TBL_RCU_InfraredPacket> TBL_RCU_InfraredPacket { get; set; }
public virtual DbSet<UserAuthoes> UserAuthoes { get; set; }
public virtual DbSet<UserLog> UserLog { get; set; }
public virtual DbSet<TBL_MultilingualApps> TBL_MultilingualApps { get; set; }
public virtual DbSet<TBL_MultilingualData> TBL_MultilingualData { get; set; }
public virtual DbSet<Hotels> Hotels { get; set; }
public virtual DbSet<UserInfo> UserInfo { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"AuthorityDBModel.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,10 @@
// 为模型“D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\Faces\Face.Domain\Entities\AuthorityDBModel.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时此属性会出现在
// “属性”窗口中。
// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
// 类,请在设计器中打开该模型,右键单击设计器图面,然后
// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
// 项...”。

View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -0,0 +1,905 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="AuthorityDBModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="__MigrationHistory">
<Key>
<PropertyRef Name="MigrationId" />
<PropertyRef Name="ContextKey" />
</Key>
<Property Name="MigrationId" Type="nvarchar" MaxLength="150" Nullable="false" />
<Property Name="ContextKey" Type="nvarchar" MaxLength="300" Nullable="false" />
<Property Name="Model" Type="varbinary(max)" Nullable="false" />
<Property Name="ProductVersion" Type="nvarchar" MaxLength="32" Nullable="false" />
</EntityType>
<EntityType Name="AppAutho">
<Key>
<PropertyRef Name="AppId" />
<PropertyRef Name="AuthorityId" />
</Key>
<Property Name="AppId" Type="int" Nullable="false" />
<Property Name="AuthorityId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="Authority">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AuthorityName" Type="nvarchar(max)" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
<Property Name="IsValid" Type="int" />
<Property Name="AuthoStatusTypeId" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="AuthoStatusType">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="DbLog">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Content" Type="nvarchar(max)" />
<Property Name="Uid" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="Type" Type="int" Nullable="false" />
<Property Name="Ip" Type="nvarchar" MaxLength="50" />
<Property Name="Client" Type="nvarchar(max)" />
<Property Name="location" Type="nvarchar" MaxLength="150" />
</EntityType>
<EntityType Name="Hosts">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="HotelID" Type="int" Nullable="false" />
<Property Name="RoomNumber" Type="nvarchar(max)" />
<Property Name="Status" Type="int" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="RoomStatusID" Type="int" />
</EntityType>
<EntityType Name="HotelGroups">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="nvarchar(max)" />
<Property Name="ParentId" Type="int" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
</EntityType>
<EntityType Name="Hotels">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" Nullable="false" />
<Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="Desc" Type="nvarchar" MaxLength="50" />
<Property Name="GroupId" Type="int" Nullable="false" />
<Property Name="Code" Type="nvarchar" MaxLength="50" />
<Property Name="Status" Type="int" Nullable="false" />
<Property Name="IsApprove" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
</EntityType>
<EntityType Name="OrgAuthority">
<Key>
<PropertyRef Name="OrgId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
</Key>
<Property Name="OrgId" Type="int" Nullable="false" />
<Property Name="AuthorityId" Type="int" Nullable="false" />
<Property Name="HotelId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AuthotypeId" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="datetime" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="TBL_Multilingual">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Language" Type="nvarchar" MaxLength="254" />
<Property Name="ApplicationID" Type="nvarchar" MaxLength="254" />
<Property Name="Version" Type="int" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“AuthorityDB.dbo.TBL_MultilingualApps”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_MultilingualApps">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Application" Type="nvarchar" MaxLength="254" />
<Property Name="Remark" Type="nvarchar" MaxLength="254" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“AuthorityDB.dbo.TBL_MultilingualData”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_MultilingualData">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="中文" Type="nvarchar" MaxLength="254" />
<Property Name="English" Type="nvarchar" MaxLength="254" />
<Property Name="ApplicationID" Type="nvarchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_RCU_InfraredPacket">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Type" Type="varchar" MaxLength="254" />
<Property Name="Brand" Type="varchar" MaxLength="254" />
<Property Name="Model" Type="varchar" MaxLength="254" />
<Property Name="Version" Type="varchar" MaxLength="254" />
<Property Name="CreateDate" Type="datetime" />
<Property Name="PacketName" Type="varchar" MaxLength="254" />
<Property Name="PacketData" Type="image" />
<Property Name="PacketMD5" Type="varchar" MaxLength="254" />
<Property Name="Remark" Type="text" />
<Property Name="OldPacket" Type="bit" />
</EntityType>
<EntityType Name="UserAuthoes">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
</Key>
<Property Name="UserId" Type="int" Nullable="false" />
<Property Name="AuthorityId" Type="int" Nullable="false" />
<Property Name="HotelId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AuthotypeId" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="nvarchar(max)" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="UserInfo">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Uid" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="Pwd" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="PwdSee" Type="nvarchar(max)" />
<Property Name="HeadImg" Type="nvarchar(max)" Nullable="false" />
<Property Name="Sex" Type="int" Nullable="false" />
<Property Name="Age" Type="int" />
<Property Name="IsValid" Type="int" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
<Property Name="HotelID" Type="int" />
<Property Name="HotelGroupID" Type="int" />
<Property Name="IsImport" Type="int" Nullable="false" />
<Property Name="Company" Type="int" />
<Property Name="OldId" Type="int" />
<Property Name="EndTime" Type="datetime" />
<Property Name="Autho" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="UserLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="nvarchar" MaxLength="254" />
</EntityType>
<Association Name="FK_dbo_AppAutho_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="AppAutho" Type="Self.AppAutho" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="AppAutho">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_OrgAuthority_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="OrgAuthority" Type="Self.OrgAuthority" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgAuthority">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" Type="Self.AuthoStatusType" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="OrgAuthority" Type="Self.OrgAuthority" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="AuthoStatusType">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgAuthority">
<PropertyRef Name="AuthotypeId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_UserAuthoes_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="UserAuthoes" Type="Self.UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" Type="Self.AuthoStatusType" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="UserAuthoes" Type="Self.UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="AuthoStatusType">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="AuthotypeId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_UserAuthoes_dbo_UserInfo_UserId">
<End Role="UserInfo" Type="Self.UserInfo" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="UserAuthoes" Type="Self.UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="UserInfo">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="UserId" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="AuthorityDBModelStoreContainer">
<EntitySet Name="__MigrationHistory" EntityType="Self.__MigrationHistory" Schema="dbo" store:Type="Tables" />
<EntitySet Name="AppAutho" EntityType="Self.AppAutho" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Authority" EntityType="Self.Authority" Schema="dbo" store:Type="Tables" />
<EntitySet Name="AuthoStatusType" EntityType="Self.AuthoStatusType" Schema="dbo" store:Type="Tables" />
<EntitySet Name="DbLog" EntityType="Self.DbLog" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Hosts" EntityType="Self.Hosts" Schema="dbo" store:Type="Tables" />
<EntitySet Name="HotelGroups" EntityType="Self.HotelGroups" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Hotels" EntityType="Self.Hotels" Schema="dbo" store:Type="Tables" />
<EntitySet Name="OrgAuthority" EntityType="Self.OrgAuthority" Schema="dbo" store:Type="Tables" />
<EntitySet Name="TBL_Multilingual" EntityType="Self.TBL_Multilingual" Schema="dbo" store:Type="Tables" />
<EntitySet Name="TBL_RCU_InfraredPacket" EntityType="Self.TBL_RCU_InfraredPacket" Schema="dbo" store:Type="Tables" />
<EntitySet Name="UserAuthoes" EntityType="Self.UserAuthoes" Schema="dbo" store:Type="Tables" />
<EntitySet Name="UserInfo" EntityType="Self.UserInfo" Schema="dbo" store:Type="Tables" />
<EntitySet Name="UserLog" EntityType="Self.UserLog" Schema="dbo" store:Type="Tables" />
<EntitySet Name="TBL_MultilingualApps" EntityType="Self.TBL_MultilingualApps" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_MultilingualApps].[ID] AS [ID],
[TBL_MultilingualApps].[Application] AS [Application],
[TBL_MultilingualApps].[Remark] AS [Remark]
FROM [dbo].[TBL_MultilingualApps] AS [TBL_MultilingualApps]</DefiningQuery>
</EntitySet>
<EntitySet Name="TBL_MultilingualData" EntityType="Self.TBL_MultilingualData" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_MultilingualData].[ID] AS [ID],
[TBL_MultilingualData].[中文] AS [中文],
[TBL_MultilingualData].[English] AS [English],
[TBL_MultilingualData].[ApplicationID] AS [ApplicationID]
FROM [dbo].[TBL_MultilingualData] AS [TBL_MultilingualData]</DefiningQuery>
</EntitySet>
<AssociationSet Name="FK_dbo_AppAutho_dbo_Authority_AuthorityId" Association="Self.FK_dbo_AppAutho_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="AppAutho" EntitySet="AppAutho" />
</AssociationSet>
<AssociationSet Name="FK_dbo_OrgAuthority_dbo_Authority_AuthorityId" Association="Self.FK_dbo_OrgAuthority_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="OrgAuthority" EntitySet="OrgAuthority" />
</AssociationSet>
<AssociationSet Name="FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId" Association="Self.FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" EntitySet="AuthoStatusType" />
<End Role="OrgAuthority" EntitySet="OrgAuthority" />
</AssociationSet>
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_Authority_AuthorityId" Association="Self.FK_dbo_UserAuthoes_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId" Association="Self.FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" EntitySet="AuthoStatusType" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_UserInfo_UserId" Association="Self.FK_dbo_UserAuthoes_dbo_UserInfo_UserId">
<End Role="UserInfo" EntitySet="UserInfo" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
</EntityContainer>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="AuthorityDBModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="C__MigrationHistory">
<Key>
<PropertyRef Name="MigrationId" />
<PropertyRef Name="ContextKey" />
</Key>
<Property Name="MigrationId" Type="String" MaxLength="150" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="ContextKey" Type="String" MaxLength="300" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Model" Type="Binary" MaxLength="Max" FixedLength="false" Nullable="false" />
<Property Name="ProductVersion" Type="String" MaxLength="32" FixedLength="false" Unicode="true" Nullable="false" />
</EntityType>
<EntityType Name="AppAutho">
<Key>
<PropertyRef Name="AppId" />
<PropertyRef Name="AuthorityId" />
</Key>
<Property Name="AppId" Type="Int32" Nullable="false" />
<Property Name="AuthorityId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<NavigationProperty Name="Authority" Relationship="Self.FK_dbo_AppAutho_dbo_Authority_AuthorityId" FromRole="AppAutho" ToRole="Authority" />
</EntityType>
<EntityType Name="Authority">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AuthorityName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="IsValid" Type="Int32" />
<NavigationProperty Name="AppAutho" Relationship="Self.FK_dbo_AppAutho_dbo_Authority_AuthorityId" FromRole="Authority" ToRole="AppAutho" />
<NavigationProperty Name="OrgAuthority" Relationship="Self.FK_dbo_OrgAuthority_dbo_Authority_AuthorityId" FromRole="Authority" ToRole="OrgAuthority" />
<NavigationProperty Name="UserAuthoes" Relationship="Self.FK_dbo_UserAuthoes_dbo_Authority_AuthorityId" FromRole="Authority" ToRole="UserAuthoes" />
<Property Name="AuthoStatusTypeId" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="AuthoStatusType">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<NavigationProperty Name="OrgAuthority" Relationship="Self.FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId" FromRole="AuthoStatusType" ToRole="OrgAuthority" />
<NavigationProperty Name="UserAuthoes" Relationship="Self.FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId" FromRole="AuthoStatusType" ToRole="UserAuthoes" />
</EntityType>
<EntityType Name="DbLog">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Content" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Uid" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="Type" Type="Int32" Nullable="false" />
<Property Name="Ip" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Client" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="location" Type="String" MaxLength="150" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="Hosts">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="HotelID" Type="Int32" Nullable="false" />
<Property Name="RoomNumber" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Status" Type="Int32" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="RoomStatusID" Type="Int32" />
</EntityType>
<EntityType Name="HotelGroups">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="ParentId" Type="Int32" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
</EntityType>
<EntityType Name="OrgAuthority">
<Key>
<PropertyRef Name="OrgId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
</Key>
<Property Name="OrgId" Type="Int32" Nullable="false" />
<Property Name="AuthorityId" Type="Int32" Nullable="false" />
<Property Name="HotelId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AuthotypeId" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<NavigationProperty Name="Authority" Relationship="Self.FK_dbo_OrgAuthority_dbo_Authority_AuthorityId" FromRole="OrgAuthority" ToRole="Authority" />
<NavigationProperty Name="AuthoStatusType" Relationship="Self.FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId" FromRole="OrgAuthority" ToRole="AuthoStatusType" />
</EntityType>
<EntityType Name="TBL_Multilingual">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Language" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="ApplicationID" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="Version" Type="Int32" />
</EntityType>
<EntityType Name="TBL_RCU_InfraredPacket">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Type" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Brand" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Model" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Version" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="CreateDate" Type="DateTime" Precision="3" />
<Property Name="PacketName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="PacketData" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="PacketMD5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Remark" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="OldPacket" Type="Boolean" />
</EntityType>
<EntityType Name="UserAuthoes">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
</Key>
<Property Name="UserId" Type="Int32" Nullable="false" />
<Property Name="AuthorityId" Type="Int32" Nullable="false" />
<Property Name="HotelId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AuthotypeId" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<NavigationProperty Name="Authority" Relationship="Self.FK_dbo_UserAuthoes_dbo_Authority_AuthorityId" FromRole="UserAuthoes" ToRole="Authority" />
<NavigationProperty Name="AuthoStatusType" Relationship="Self.FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId" FromRole="UserAuthoes" ToRole="AuthoStatusType" />
<NavigationProperty Name="UserInfo" Relationship="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_UserInfo_UserId" FromRole="UserAuthoes" ToRole="UserInfo" />
</EntityType>
<EntityType Name="UserLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="TBL_MultilingualApps">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Application" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="Remark" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="TBL_MultilingualData">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="中文" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="English" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="ApplicationID" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<Association Name="FK_dbo_AppAutho_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="AppAutho" Type="Self.AppAutho" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="AppAutho">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_OrgAuthority_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="OrgAuthority" Type="Self.OrgAuthority" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgAuthority">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_UserAuthoes_dbo_Authority_AuthorityId">
<End Role="Authority" Type="Self.Authority" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="UserAuthoes" Type="Self.UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Authority">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="AuthorityId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" Type="Self.AuthoStatusType" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="OrgAuthority" Type="Self.OrgAuthority" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="AuthoStatusType">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgAuthority">
<PropertyRef Name="AuthotypeId" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" Type="Self.AuthoStatusType" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="UserAuthoes" Type="Self.UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="AuthoStatusType">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="AuthotypeId" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="AuthorityDBEntitiesShow" annotation:LazyLoadingEnabled="true">
<EntitySet Name="C__MigrationHistory" EntityType="Self.C__MigrationHistory" />
<EntitySet Name="AppAutho" EntityType="Self.AppAutho" />
<EntitySet Name="Authority" EntityType="Self.Authority" />
<EntitySet Name="AuthoStatusType" EntityType="Self.AuthoStatusType" />
<EntitySet Name="DbLog" EntityType="Self.DbLog" />
<EntitySet Name="Hosts" EntityType="Self.Hosts" />
<EntitySet Name="HotelGroups" EntityType="Self.HotelGroups" />
<EntitySet Name="OrgAuthority" EntityType="Self.OrgAuthority" />
<EntitySet Name="TBL_Multilingual" EntityType="Self.TBL_Multilingual" />
<EntitySet Name="TBL_RCU_InfraredPacket" EntityType="Self.TBL_RCU_InfraredPacket" />
<EntitySet Name="UserAuthoes" EntityType="Self.UserAuthoes" />
<EntitySet Name="UserLog" EntityType="Self.UserLog" />
<EntitySet Name="TBL_MultilingualApps" EntityType="Self.TBL_MultilingualApps" />
<EntitySet Name="TBL_MultilingualData" EntityType="Self.TBL_MultilingualData" />
<AssociationSet Name="FK_dbo_AppAutho_dbo_Authority_AuthorityId" Association="Self.FK_dbo_AppAutho_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="AppAutho" EntitySet="AppAutho" />
</AssociationSet>
<AssociationSet Name="FK_dbo_OrgAuthority_dbo_Authority_AuthorityId" Association="Self.FK_dbo_OrgAuthority_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="OrgAuthority" EntitySet="OrgAuthority" />
</AssociationSet>
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_Authority_AuthorityId" Association="Self.FK_dbo_UserAuthoes_dbo_Authority_AuthorityId">
<End Role="Authority" EntitySet="Authority" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
<AssociationSet Name="FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId" Association="Self.FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" EntitySet="AuthoStatusType" />
<End Role="OrgAuthority" EntitySet="OrgAuthority" />
</AssociationSet>
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId" Association="Self.FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId">
<End Role="AuthoStatusType" EntitySet="AuthoStatusType" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
<EntitySet Name="Hotels" EntityType="AuthorityDBModel.Hotels" />
<EntitySet Name="UserInfo" EntityType="AuthorityDBModel.UserInfo" />
<AssociationSet Name="FK_dbo_UserAuthoes_dbo_UserInfo_UserId" Association="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_UserInfo_UserId">
<End Role="UserInfo" EntitySet="UserInfo" />
<End Role="UserAuthoes" EntitySet="UserAuthoes" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Hotels">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Desc" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="GroupId" Type="Int32" Nullable="false" />
<Property Name="Code" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Status" Type="Int32" Nullable="false" />
<Property Name="IsApprove" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
</EntityType>
<EntityType Name="UserInfo">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Uid" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Pwd" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="PwdSee" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="HeadImg" Type="String" Nullable="false" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Sex" Type="Int32" Nullable="false" />
<Property Name="Age" Type="Int32" />
<Property Name="IsValid" Type="Int32" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="HotelID" Type="Int32" />
<Property Name="HotelGroupID" Type="Int32" />
<Property Name="IsImport" Type="Int32" Nullable="false" />
<Property Name="Company" Type="Int32" />
<Property Name="OldId" Type="Int32" />
<Property Name="EndTime" Type="DateTime" Precision="3" />
<Property Name="Autho" Type="Int32" Nullable="false" />
<NavigationProperty Name="UserAuthoes" Relationship="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_UserInfo_UserId" FromRole="UserInfo" ToRole="UserAuthoes" />
</EntityType>
<Association Name="FK_dbo_UserAuthoes_dbo_UserInfo_UserId">
<End Type="AuthorityDBModel.UserInfo" Role="UserInfo" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Type="AuthorityDBModel.UserAuthoes" Role="UserAuthoes" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="UserInfo">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="UserAuthoes">
<PropertyRef Name="UserId" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="AuthorityDBModelStoreContainer" CdmEntityContainer="AuthorityDBEntitiesShow">
<EntitySetMapping Name="C__MigrationHistory">
<EntityTypeMapping TypeName="AuthorityDBModel.C__MigrationHistory">
<MappingFragment StoreEntitySet="__MigrationHistory">
<ScalarProperty Name="MigrationId" ColumnName="MigrationId" />
<ScalarProperty Name="ContextKey" ColumnName="ContextKey" />
<ScalarProperty Name="Model" ColumnName="Model" />
<ScalarProperty Name="ProductVersion" ColumnName="ProductVersion" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="AppAutho">
<EntityTypeMapping TypeName="AuthorityDBModel.AppAutho">
<MappingFragment StoreEntitySet="AppAutho">
<ScalarProperty Name="AppId" ColumnName="AppId" />
<ScalarProperty Name="AuthorityId" ColumnName="AuthorityId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Authority">
<EntityTypeMapping TypeName="AuthorityDBModel.Authority">
<MappingFragment StoreEntitySet="Authority">
<ScalarProperty Name="AuthoStatusTypeId" ColumnName="AuthoStatusTypeId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AuthorityName" ColumnName="AuthorityName" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="AuthoStatusType">
<EntityTypeMapping TypeName="AuthorityDBModel.AuthoStatusType">
<MappingFragment StoreEntitySet="AuthoStatusType">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="DbLog">
<EntityTypeMapping TypeName="AuthorityDBModel.DbLog">
<MappingFragment StoreEntitySet="DbLog">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Content" ColumnName="Content" />
<ScalarProperty Name="Uid" ColumnName="Uid" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="Type" ColumnName="Type" />
<ScalarProperty Name="Ip" ColumnName="Ip" />
<ScalarProperty Name="Client" ColumnName="Client" />
<ScalarProperty Name="location" ColumnName="location" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Hosts">
<EntityTypeMapping TypeName="AuthorityDBModel.Hosts">
<MappingFragment StoreEntitySet="Hosts">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="HotelID" ColumnName="HotelID" />
<ScalarProperty Name="RoomNumber" ColumnName="RoomNumber" />
<ScalarProperty Name="Status" ColumnName="Status" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="RoomStatusID" ColumnName="RoomStatusID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="HotelGroups">
<EntityTypeMapping TypeName="AuthorityDBModel.HotelGroups">
<MappingFragment StoreEntitySet="HotelGroups">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="ParentId" ColumnName="ParentId" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="OrgAuthority">
<EntityTypeMapping TypeName="AuthorityDBModel.OrgAuthority">
<MappingFragment StoreEntitySet="OrgAuthority">
<ScalarProperty Name="OrgId" ColumnName="OrgId" />
<ScalarProperty Name="AuthorityId" ColumnName="AuthorityId" />
<ScalarProperty Name="HotelId" ColumnName="HotelId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AuthotypeId" ColumnName="AuthotypeId" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_Multilingual">
<EntityTypeMapping TypeName="AuthorityDBModel.TBL_Multilingual">
<MappingFragment StoreEntitySet="TBL_Multilingual">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Language" ColumnName="Language" />
<ScalarProperty Name="ApplicationID" ColumnName="ApplicationID" />
<ScalarProperty Name="Version" ColumnName="Version" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_RCU_InfraredPacket">
<EntityTypeMapping TypeName="AuthorityDBModel.TBL_RCU_InfraredPacket">
<MappingFragment StoreEntitySet="TBL_RCU_InfraredPacket">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Type" ColumnName="Type" />
<ScalarProperty Name="Brand" ColumnName="Brand" />
<ScalarProperty Name="Model" ColumnName="Model" />
<ScalarProperty Name="Version" ColumnName="Version" />
<ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
<ScalarProperty Name="PacketName" ColumnName="PacketName" />
<ScalarProperty Name="PacketData" ColumnName="PacketData" />
<ScalarProperty Name="PacketMD5" ColumnName="PacketMD5" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="OldPacket" ColumnName="OldPacket" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserAuthoes">
<EntityTypeMapping TypeName="AuthorityDBModel.UserAuthoes">
<MappingFragment StoreEntitySet="UserAuthoes">
<ScalarProperty Name="UserId" ColumnName="UserId" />
<ScalarProperty Name="AuthorityId" ColumnName="AuthorityId" />
<ScalarProperty Name="HotelId" ColumnName="HotelId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AuthotypeId" ColumnName="AuthotypeId" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserLog">
<EntityTypeMapping TypeName="AuthorityDBModel.UserLog">
<MappingFragment StoreEntitySet="UserLog">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_MultilingualApps">
<EntityTypeMapping TypeName="AuthorityDBModel.TBL_MultilingualApps">
<MappingFragment StoreEntitySet="TBL_MultilingualApps">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Application" ColumnName="Application" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_MultilingualData">
<EntityTypeMapping TypeName="AuthorityDBModel.TBL_MultilingualData">
<MappingFragment StoreEntitySet="TBL_MultilingualData">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="中文" ColumnName="中文" />
<ScalarProperty Name="English" ColumnName="English" />
<ScalarProperty Name="ApplicationID" ColumnName="ApplicationID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Hotels">
<EntityTypeMapping TypeName="AuthorityDBModel.Hotels">
<MappingFragment StoreEntitySet="Hotels">
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="IsApprove" ColumnName="IsApprove" />
<ScalarProperty Name="Status" ColumnName="Status" />
<ScalarProperty Name="Code" ColumnName="Code" />
<ScalarProperty Name="GroupId" ColumnName="GroupId" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="Id" ColumnName="Id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserInfo">
<EntityTypeMapping TypeName="AuthorityDBModel.UserInfo">
<MappingFragment StoreEntitySet="UserInfo">
<ScalarProperty Name="Autho" ColumnName="Autho" />
<ScalarProperty Name="EndTime" ColumnName="EndTime" />
<ScalarProperty Name="OldId" ColumnName="OldId" />
<ScalarProperty Name="Company" ColumnName="Company" />
<ScalarProperty Name="IsImport" ColumnName="IsImport" />
<ScalarProperty Name="HotelGroupID" ColumnName="HotelGroupID" />
<ScalarProperty Name="HotelID" ColumnName="HotelID" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
<ScalarProperty Name="Age" ColumnName="Age" />
<ScalarProperty Name="Sex" ColumnName="Sex" />
<ScalarProperty Name="HeadImg" ColumnName="HeadImg" />
<ScalarProperty Name="PwdSee" ColumnName="PwdSee" />
<ScalarProperty Name="Pwd" ColumnName="Pwd" />
<ScalarProperty Name="Uid" ColumnName="Uid" />
<ScalarProperty Name="Id" ColumnName="Id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="无" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="dc5d5efeb81f4fddb821e356e7ef394a" Name="Diagram1">
<EntityTypeShape EntityType="AuthorityDBModel.C__MigrationHistory" Width="1.5" PointX="5.75" PointY="0.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.AppAutho" Width="1.5" PointX="3" PointY="5" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.Authority" Width="1.5" PointX="0.75" PointY="4.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.AuthoStatusType" Width="1.5" PointX="0.75" PointY="1.25" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.DbLog" Width="1.5" PointX="7.75" PointY="0.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.Hosts" Width="1.5" PointX="8.75" PointY="4.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.HotelGroups" Width="1.5" PointX="8.75" PointY="8.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.OrgAuthority" Width="1.5" PointX="6" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.TBL_Multilingual" Width="1.5" PointX="10.75" PointY="4.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.TBL_RCU_InfraredPacket" Width="1.5" PointX="10.75" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.UserAuthoes" Width="1.5" PointX="3" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.UserLog" Width="1.5" PointX="11.75" PointY="0.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.TBL_MultilingualApps" Width="1.5" PointX="8.75" PointY="11.875" IsExpanded="true" />
<EntityTypeShape EntityType="AuthorityDBModel.TBL_MultilingualData" Width="1.5" PointX="10.75" PointY="11.875" IsExpanded="true" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_AppAutho_dbo_Authority_AuthorityId" ManuallyRouted="false" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_OrgAuthority_dbo_Authority_AuthorityId" ManuallyRouted="false" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_Authority_AuthorityId" ManuallyRouted="false" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_OrgAuthority_dbo_AuthoStatusType_AuthotypeId" ManuallyRouted="false" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_AuthoStatusType_AuthotypeId" ManuallyRouted="false" />
<EntityTypeShape EntityType="AuthorityDBModel.Hotels" Width="1.5" PointX="13.375" PointY="3.75" />
<EntityTypeShape EntityType="AuthorityDBModel.UserInfo" Width="1.5" PointX="0.75" PointY="9" />
<AssociationConnector Association="AuthorityDBModel.FK_dbo_UserAuthoes_dbo_UserInfo_UserId" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"AuthorityDBModel.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class C__MigrationHistory
{
public string MigrationId { get; set; }
public string ContextKey { get; set; }
public byte[] Model { get; set; }
public string ProductVersion { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class CheckInInfo
{
public int id { get; set; }
public string Name { get; set; }
public string IdNumber { get; set; }
public Nullable<System.DateTime> CreationTime { get; set; }
public int InfoSource { get; set; }
public Nullable<int> HotelCode { get; set; }
public Nullable<int> Roomid { get; set; }
public Nullable<System.DateTime> CheckTime { get; set; }
public Nullable<System.DateTime> checkOutTime { get; set; }
public string picture { get; set; }
public string identitys { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class CheckinTest
{
public int id { get; set; }
public Nullable<int> testState { get; set; }
public Nullable<System.DateTime> predictCheckIn { get; set; }
public Nullable<System.DateTime> creationTime { get; set; }
public Nullable<int> checkInduration { get; set; }
public Nullable<int> hotelid { get; set; }
public Nullable<int> Roomid { get; set; }
public Nullable<System.DateTime> CheckoutTime { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Dailyoperation
{
public int id { get; set; }
public string Uname { get; set; }
public System.DateTime Creationtime { get; set; }
public string operatetype { get; set; }
public string operatedata { get; set; }
public int hotelCode { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class DbLog
{
public int Id { get; set; }
public string Content { get; set; }
public string Uid { get; set; }
public System.DateTime CreateTime { get; set; }
public int Type { get; set; }
public string Ip { get; set; }
public string Client { get; set; }
public string location { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class DeviceManage
{
public int Facelid { get; set; }
public string SerialNo { get; set; }
public Nullable<System.DateTime> CreatedDate { get; set; }
public string HotelCode { get; set; }
public Nullable<int> RoomId { get; set; }
public string Factory { get; set; }
public bool Status { get; set; }
public Nullable<System.DateTime> bindingDate { get; set; }
public bool bindingStatus { get; set; }
public string faceIp { get; set; }
public string faceAddress { get; set; }
public Nullable<int> maintainStatus { get; set; }
public string APKVersion { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class FaceBinding
{
public int ID { get; set; }
public string SerialNo { get; set; }
public string Operator { get; set; }
public Nullable<bool> OperatorType { get; set; }
public Nullable<System.DateTime> bindingDate { get; set; }
public Nullable<int> HotelCode { get; set; }
public Nullable<int> RoomId { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class faceEntities : DbContext
{
public faceEntities()
: base("name=faceEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<company> company { get; set; }
public virtual DbSet<DeviceManage> DeviceManage { get; set; }
public virtual DbSet<Hotel> Hotel { get; set; }
public virtual DbSet<ImageList> ImageList { get; set; }
public virtual DbSet<Operator> Operator { get; set; }
public virtual DbSet<OperatorrList> OperatorrList { get; set; }
public virtual DbSet<ROOM> ROOM { get; set; }
public virtual DbSet<UserList> UserList { get; set; }
public virtual DbSet<OperatorLog> OperatorLog { get; set; }
public virtual DbSet<UserLog> UserLog { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"FaceDaoEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,10 @@
// 为模型“D:\Face\Faces\Face.Domain\Entities\FaceDaoEntity.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时此属性会出现在
// “属性”窗口中。
// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
// 类,请在设计器中打开该模型,右键单击设计器图面,然后
// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
// 项...”。

View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -0,0 +1,445 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="faceModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="company">
<Key>
<PropertyRef Name="companyid" />
</Key>
<Property Name="companyid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="companyname" Type="nvarchar" MaxLength="20" Nullable="false" />
<Property Name="companyremark" Type="nvarchar" MaxLength="100" />
</EntityType>
<EntityType Name="DeviceManage">
<Key>
<PropertyRef Name="Facelid" />
</Key>
<Property Name="Facelid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Facestate" Type="char" MaxLength="4" Nullable="false" />
<Property Name="snnumber" Type="varchar" MaxLength="200" Nullable="false" />
<Property Name="hotelid" Type="int" Nullable="false" />
<Property Name="houseid" Type="int" Nullable="false" />
<Property Name="photograph" Type="varbinary" MaxLength="50" />
<Property Name="creationdate" Type="datetime" Nullable="false" />
<Property Name="datechanged" Type="datetime" />
</EntityType>
<EntityType Name="Hotel">
<Key>
<PropertyRef Name="hotelid" />
</Key>
<Property Name="hotelid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="hotelname" Type="varchar" MaxLength="50" Nullable="false" />
</EntityType>
<EntityType Name="ImageList">
<Key>
<PropertyRef Name="Imageid" />
</Key>
<Property Name="Imageid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Image" Type="nvarchar" MaxLength="254" Nullable="false" />
<Property Name="hotelid" Type="int" Nullable="false" />
<Property Name="houseid" Type="int" Nullable="false" />
<Property Name="userid" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="Operator">
<Key>
<PropertyRef Name="Operatorid" />
</Key>
<Property Name="Operatorid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="name" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="pwd" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="companyid" Type="int" Nullable="false" />
<Property Name="mobile" Type="int" Nullable="false" />
<Property Name="tencentAI" Type="nvarchar" MaxLength="50" />
<Property Name="createdate" Type="datetime" Nullable="false" />
<Property Name="Isenabled" Type="bit" Nullable="false" />
<Property Name="Operatorlistid" Type="int" Nullable="false" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“face.dbo.OperatorLog”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="OperatorLog">
<Key>
<PropertyRef Name="ologdate" />
<PropertyRef Name="Operatorid" />
<PropertyRef Name="Browsertype" />
<PropertyRef Name="ipaddress" />
<PropertyRef Name="operationtype" />
<PropertyRef Name="operatingdata" />
</Key>
<Property Name="ologdate" Type="datetime" Nullable="false" />
<Property Name="Operatorid" Type="int" Nullable="false" />
<Property Name="Browsertype" Type="nvarchar" MaxLength="20" Nullable="false" />
<Property Name="ipaddress" Type="nvarchar" MaxLength="200" Nullable="false" />
<Property Name="operationtype" Type="nvarchar" MaxLength="10" Nullable="false" />
<Property Name="operatingdata" Type="nvarchar" MaxLength="70" Nullable="false" />
</EntityType>
<EntityType Name="OperatorrList">
<Key>
<PropertyRef Name="Operatorlistid" />
</Key>
<Property Name="Operatorlistid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Operatorlistname" Type="varchar" MaxLength="10" Nullable="false" />
<Property Name="Operatorlistremark" Type="varchar" MaxLength="50" />
</EntityType>
<EntityType Name="ROOM">
<Key>
<PropertyRef Name="houseid" />
</Key>
<Property Name="houseid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="housename" Type="varchar" MaxLength="50" Nullable="false" />
<Property Name="hotelid" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="UserList">
<Key>
<PropertyRef Name="userid" />
</Key>
<Property Name="userid" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="username" Type="varchar" MaxLength="10" Nullable="false" />
<Property Name="status" Type="varchar" MaxLength="10" Nullable="false" />
<Property Name="usersex" Type="char" MaxLength="2" Nullable="false" />
<Property Name="identitys" Type="varchar" MaxLength="20" Nullable="false" />
<Property Name="edttime" Type="date" Nullable="false" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“face.dbo.UserLog”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="UserLog">
<Key>
<PropertyRef Name="ulogdate" />
<PropertyRef Name="userid" />
<PropertyRef Name="Facelid" />
<PropertyRef Name="Operatorid" />
</Key>
<Property Name="ulogdate" Type="datetime" Nullable="false" />
<Property Name="userid" Type="int" Nullable="false" />
<Property Name="Facelid" Type="int" Nullable="false" />
<Property Name="uoperate" Type="nvarchar" MaxLength="10" />
<Property Name="Operatorid" Type="int" Nullable="false" />
</EntityType>
<Association Name="FK_Operator_Operator">
<End Role="Operator" Type="Self.Operator" Multiplicity="1" />
<End Role="Operator1" Type="Self.Operator" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Operator">
<PropertyRef Name="Operatorid" />
</Principal>
<Dependent Role="Operator1">
<PropertyRef Name="Operatorid" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="faceModelStoreContainer">
<EntitySet Name="company" EntityType="Self.company" Schema="dbo" store:Type="Tables" />
<EntitySet Name="DeviceManage" EntityType="Self.DeviceManage" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Hotel" EntityType="Self.Hotel" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ImageList" EntityType="Self.ImageList" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Operator" EntityType="Self.Operator" Schema="dbo" store:Type="Tables" />
<EntitySet Name="OperatorrList" EntityType="Self.OperatorrList" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ROOM" EntityType="Self.ROOM" Schema="dbo" store:Type="Tables" />
<EntitySet Name="UserList" EntityType="Self.UserList" Schema="dbo" store:Type="Tables" />
<EntitySet Name="OperatorLog" EntityType="Self.OperatorLog" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[OperatorLog].[ologdate] AS [ologdate],
[OperatorLog].[Operatorid] AS [Operatorid],
[OperatorLog].[Browsertype] AS [Browsertype],
[OperatorLog].[ipaddress] AS [ipaddress],
[OperatorLog].[operationtype] AS [operationtype],
[OperatorLog].[operatingdata] AS [operatingdata]
FROM [dbo].[OperatorLog] AS [OperatorLog]</DefiningQuery>
</EntitySet>
<EntitySet Name="UserLog" EntityType="Self.UserLog" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[UserLog].[ulogdate] AS [ulogdate],
[UserLog].[userid] AS [userid],
[UserLog].[Facelid] AS [Facelid],
[UserLog].[uoperate] AS [uoperate],
[UserLog].[Operatorid] AS [Operatorid]
FROM [dbo].[UserLog] AS [UserLog]</DefiningQuery>
</EntitySet>
<AssociationSet Name="FK_Operator_Operator" Association="Self.FK_Operator_Operator">
<End Role="Operator" EntitySet="Operator" />
<End Role="Operator1" EntitySet="Operator" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="faceModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="company">
<Key>
<PropertyRef Name="companyid" />
</Key>
<Property Name="companyid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="companyname" Type="String" MaxLength="20" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="companyremark" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="DeviceManage">
<Key>
<PropertyRef Name="Facelid" />
</Key>
<Property Name="Facelid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Facestate" Type="String" MaxLength="4" FixedLength="true" Unicode="false" Nullable="false" />
<Property Name="snnumber" Type="String" MaxLength="200" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="hotelid" Type="Int32" Nullable="false" />
<Property Name="houseid" Type="Int32" Nullable="false" />
<Property Name="photograph" Type="Binary" MaxLength="50" FixedLength="false" />
<Property Name="creationdate" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="datechanged" Type="DateTime" Precision="3" />
</EntityType>
<EntityType Name="Hotel">
<Key>
<PropertyRef Name="hotelid" />
</Key>
<Property Name="hotelid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="hotelname" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
</EntityType>
<EntityType Name="ImageList">
<Key>
<PropertyRef Name="Imageid" />
</Key>
<Property Name="Imageid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Image" Type="String" MaxLength="254" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="hotelid" Type="Int32" Nullable="false" />
<Property Name="houseid" Type="Int32" Nullable="false" />
<Property Name="userid" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="Operator">
<Key>
<PropertyRef Name="Operatorid" />
</Key>
<Property Name="Operatorid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="pwd" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="companyid" Type="Int32" Nullable="false" />
<Property Name="mobile" Type="Int32" Nullable="false" />
<Property Name="tencentAI" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="createdate" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="Isenabled" Type="Boolean" Nullable="false" />
<Property Name="Operatorlistid" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="OperatorrList">
<Key>
<PropertyRef Name="Operatorlistid" />
</Key>
<Property Name="Operatorlistid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Operatorlistname" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Operatorlistremark" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="ROOM">
<Key>
<PropertyRef Name="houseid" />
</Key>
<Property Name="houseid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="housename" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="hotelid" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="UserList">
<Key>
<PropertyRef Name="userid" />
</Key>
<Property Name="userid" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="username" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="status" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="usersex" Type="String" MaxLength="2" FixedLength="true" Unicode="false" Nullable="false" />
<Property Name="identitys" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="edttime" Type="DateTime" Nullable="false" Precision="0" />
</EntityType>
<EntityType Name="OperatorLog">
<Key>
<PropertyRef Name="ologdate" />
<PropertyRef Name="Operatorid" />
<PropertyRef Name="Browsertype" />
<PropertyRef Name="ipaddress" />
<PropertyRef Name="operationtype" />
<PropertyRef Name="operatingdata" />
</Key>
<Property Name="ologdate" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="Operatorid" Type="Int32" Nullable="false" />
<Property Name="Browsertype" Type="String" MaxLength="20" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="ipaddress" Type="String" MaxLength="200" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="operationtype" Type="String" MaxLength="10" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="operatingdata" Type="String" MaxLength="70" FixedLength="false" Unicode="true" Nullable="false" />
</EntityType>
<EntityType Name="UserLog">
<Key>
<PropertyRef Name="ulogdate" />
<PropertyRef Name="userid" />
<PropertyRef Name="Facelid" />
<PropertyRef Name="Operatorid" />
</Key>
<Property Name="ulogdate" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="userid" Type="Int32" Nullable="false" />
<Property Name="Facelid" Type="Int32" Nullable="false" />
<Property Name="uoperate" Type="String" MaxLength="10" FixedLength="false" Unicode="true" />
<Property Name="Operatorid" Type="Int32" Nullable="false" />
</EntityType>
<Association Name="FK_Operator_Operator">
<End Role="Operator" Type="Self.Operator" Multiplicity="1" />
<End Role="Operator1" Type="Self.Operator" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Operator">
<PropertyRef Name="Operatorid" />
</Principal>
<Dependent Role="Operator1">
<PropertyRef Name="Operatorid" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="faceEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="company" EntityType="Self.company" />
<EntitySet Name="DeviceManage" EntityType="Self.DeviceManage" />
<EntitySet Name="Hotel" EntityType="Self.Hotel" />
<EntitySet Name="ImageList" EntityType="Self.ImageList" />
<EntitySet Name="Operator" EntityType="Self.Operator" />
<EntitySet Name="OperatorrList" EntityType="Self.OperatorrList" />
<EntitySet Name="ROOM" EntityType="Self.ROOM" />
<EntitySet Name="UserList" EntityType="Self.UserList" />
<EntitySet Name="OperatorLog" EntityType="Self.OperatorLog" />
<EntitySet Name="UserLog" EntityType="Self.UserLog" />
<AssociationSet Name="FK_Operator_Operator" Association="Self.FK_Operator_Operator">
<End Role="Operator" EntitySet="Operator" />
<End Role="Operator1" EntitySet="Operator" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="faceModelStoreContainer" CdmEntityContainer="faceEntities">
<EntitySetMapping Name="company">
<EntityTypeMapping TypeName="faceModel.company">
<MappingFragment StoreEntitySet="company">
<ScalarProperty Name="companyid" ColumnName="companyid" />
<ScalarProperty Name="companyname" ColumnName="companyname" />
<ScalarProperty Name="companyremark" ColumnName="companyremark" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="DeviceManage">
<EntityTypeMapping TypeName="faceModel.DeviceManage">
<MappingFragment StoreEntitySet="DeviceManage">
<ScalarProperty Name="Facelid" ColumnName="Facelid" />
<ScalarProperty Name="Facestate" ColumnName="Facestate" />
<ScalarProperty Name="snnumber" ColumnName="snnumber" />
<ScalarProperty Name="hotelid" ColumnName="hotelid" />
<ScalarProperty Name="houseid" ColumnName="houseid" />
<ScalarProperty Name="photograph" ColumnName="photograph" />
<ScalarProperty Name="creationdate" ColumnName="creationdate" />
<ScalarProperty Name="datechanged" ColumnName="datechanged" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Hotel">
<EntityTypeMapping TypeName="faceModel.Hotel">
<MappingFragment StoreEntitySet="Hotel">
<ScalarProperty Name="hotelid" ColumnName="hotelid" />
<ScalarProperty Name="hotelname" ColumnName="hotelname" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="ImageList">
<EntityTypeMapping TypeName="faceModel.ImageList">
<MappingFragment StoreEntitySet="ImageList">
<ScalarProperty Name="Imageid" ColumnName="Imageid" />
<ScalarProperty Name="Image" ColumnName="Image" />
<ScalarProperty Name="hotelid" ColumnName="hotelid" />
<ScalarProperty Name="houseid" ColumnName="houseid" />
<ScalarProperty Name="userid" ColumnName="userid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Operator">
<EntityTypeMapping TypeName="faceModel.Operator">
<MappingFragment StoreEntitySet="Operator">
<ScalarProperty Name="Operatorid" ColumnName="Operatorid" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="pwd" ColumnName="pwd" />
<ScalarProperty Name="companyid" ColumnName="companyid" />
<ScalarProperty Name="mobile" ColumnName="mobile" />
<ScalarProperty Name="tencentAI" ColumnName="tencentAI" />
<ScalarProperty Name="createdate" ColumnName="createdate" />
<ScalarProperty Name="Isenabled" ColumnName="Isenabled" />
<ScalarProperty Name="Operatorlistid" ColumnName="Operatorlistid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="OperatorrList">
<EntityTypeMapping TypeName="faceModel.OperatorrList">
<MappingFragment StoreEntitySet="OperatorrList">
<ScalarProperty Name="Operatorlistid" ColumnName="Operatorlistid" />
<ScalarProperty Name="Operatorlistname" ColumnName="Operatorlistname" />
<ScalarProperty Name="Operatorlistremark" ColumnName="Operatorlistremark" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="ROOM">
<EntityTypeMapping TypeName="faceModel.ROOM">
<MappingFragment StoreEntitySet="ROOM">
<ScalarProperty Name="houseid" ColumnName="houseid" />
<ScalarProperty Name="housename" ColumnName="housename" />
<ScalarProperty Name="hotelid" ColumnName="hotelid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserList">
<EntityTypeMapping TypeName="faceModel.UserList">
<MappingFragment StoreEntitySet="UserList">
<ScalarProperty Name="userid" ColumnName="userid" />
<ScalarProperty Name="username" ColumnName="username" />
<ScalarProperty Name="status" ColumnName="status" />
<ScalarProperty Name="usersex" ColumnName="usersex" />
<ScalarProperty Name="identitys" ColumnName="identitys" />
<ScalarProperty Name="edttime" ColumnName="edttime" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="OperatorLog">
<EntityTypeMapping TypeName="faceModel.OperatorLog">
<MappingFragment StoreEntitySet="OperatorLog">
<ScalarProperty Name="ologdate" ColumnName="ologdate" />
<ScalarProperty Name="Operatorid" ColumnName="Operatorid" />
<ScalarProperty Name="Browsertype" ColumnName="Browsertype" />
<ScalarProperty Name="ipaddress" ColumnName="ipaddress" />
<ScalarProperty Name="operationtype" ColumnName="operationtype" />
<ScalarProperty Name="operatingdata" ColumnName="operatingdata" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserLog">
<EntityTypeMapping TypeName="faceModel.UserLog">
<MappingFragment StoreEntitySet="UserLog">
<ScalarProperty Name="ulogdate" ColumnName="ulogdate" />
<ScalarProperty Name="userid" ColumnName="userid" />
<ScalarProperty Name="Facelid" ColumnName="Facelid" />
<ScalarProperty Name="uoperate" ColumnName="uoperate" />
<ScalarProperty Name="Operatorid" ColumnName="Operatorid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="无" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="e79b6af4ad914f78bbd5711ea07d35f4" Name="Diagram1">
<EntityTypeShape EntityType="faceModel.company" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.DeviceManage" Width="1.5" PointX="2.75" PointY="3.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.Hotel" Width="1.5" PointX="4.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.ImageList" Width="1.5" PointX="4.75" PointY="3.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.Operator" Width="1.5" PointX="9.625" PointY="4.125" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.OperatorrList" Width="1.5" PointX="6.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.ROOM" Width="1.5" PointX="6.75" PointY="3.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.UserList" Width="1.5" PointX="4.75" PointY="6.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.OperatorLog" Width="1.5" PointX="6.75" PointY="6.75" IsExpanded="true" />
<EntityTypeShape EntityType="faceModel.UserLog" Width="1.5" PointX="0.75" PointY="7.75" IsExpanded="true" />
<AssociationConnector Association="faceModel.FK_Operator_Operator" ManuallyRouted="false" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"FaceDaoEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class FaceInfo
{
public int id { get; set; }
public System.DateTime CreationDate { get; set; }
public string SerialNo { get; set; }
public bool BindingState { get; set; }
public Nullable<System.DateTime> BindingDate { get; set; }
public Nullable<int> HotelCode { get; set; }
public Nullable<int> Roomid { get; set; }
public bool FaceState { get; set; }
public string password { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class FaceIssue
{
public int id { get; set; }
public string faceSn { get; set; }
public System.DateTime creationtime { get; set; }
public string pmsid { get; set; }
public string picture { get; set; }
public int issuestate { get; set; }
public string messageid { get; set; }
public string Factory { get; set; }
public string APKVersion { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Hosts
{
public int Id { get; set; }
public int HotelID { get; set; }
public string RoomNumber { get; set; }
public int Status { get; set; }
public string Desc { get; set; }
public System.DateTime CreateTime { get; set; }
public Nullable<int> RoomStatusID { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Hotel
{
public int ID { get; set; }
public string Code { get; set; }
public string Remark { get; set; }
public bool UserWX { get; set; }
public int HotelID { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class HotelGroups
{
public int Id { get; set; }
public string Name { get; set; }
public int ParentId { get; set; }
public string Desc { get; set; }
public System.DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Hotels
{
public int Id { get; set; }
public string Name { get; set; }
public string Desc { get; set; }
public int GroupId { get; set; }
public string Code { get; set; }
public int Status { get; set; }
public int IsApprove { get; set; }
public System.DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class ImageList
{
public int Imageid { get; set; }
public string Image { get; set; }
public int hotelid { get; set; }
public int houseid { get; set; }
public int userid { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class Uts_InHaosEntities : DbContext
{
public Uts_InHaosEntities()
: base("name=Uts_InHaosEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<TBL_Customer> TBL_Customer { get; set; }
public virtual DbSet<TBL_FlowCtr> TBL_FlowCtr { get; set; }
public virtual DbSet<TBL_Log> TBL_Log { get; set; }
public virtual DbSet<TBL_ProductionLine> TBL_ProductionLine { get; set; }
public virtual DbSet<TBL_Project> TBL_Project { get; set; }
public virtual DbSet<TBL_SyncList> TBL_SyncList { get; set; }
public virtual DbSet<TBL_StationList> TBL_StationList { get; set; }
public virtual DbSet<TBL_Orders> TBL_Orders { get; set; }
public virtual DbSet<TBL_ProductionPlan> TBL_ProductionPlan { get; set; }
public virtual DbSet<TBL_SnRules> TBL_SnRules { get; set; }
public virtual DbSet<TBL_OrderInternal> TBL_OrderInternal { get; set; }
public virtual DbSet<TBL_SnList> TBL_SnList { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"InHaosEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,10 @@
// 为模型“E:\Face\Face\Face.Domain\Entities\InHaosEntity.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时此属性会出现在
// “属性”窗口中。
// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
// 类,请在设计器中打开该模型,右键单击设计器图面,然后
// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
// 项...”。

View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -0,0 +1,531 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="Uts_InHaosModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="TBL_Customer">
<Key>
<PropertyRef Name="CompanyID" />
</Key>
<Property Name="CompanyID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CustomerAbbr" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="CustomerName" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Precision="0" Nullable="false" />
</EntityType>
<EntityType Name="TBL_FlowCtr">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ProjectID" Type="int" />
<Property Name="SUT_SN" Type="varchar" MaxLength="254" />
<Property Name="ProcessRecord" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_Log">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" Nullable="false" />
<Property Name="UserID" Type="int" />
<Property Name="DateTime" Type="datetime" Precision="0" />
<Property Name="Operation" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_OrderInternal">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrderID" Type="int" Nullable="false" />
<Property Name="InternalNo" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Precision="0" Nullable="false" />
<Property Name="ObjectiveYield" Type="int" Nullable="false" />
<Property Name="ObjectiveYieldTotal" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="TBL_Orders">
<Key>
<PropertyRef Name="OrderID" />
</Key>
<Property Name="OrderID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CompanyID" Type="int" Nullable="false" />
<Property Name="ProductID" Type="int" Nullable="false" />
<Property Name="OrderNo" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="OrderCount" Type="int" Nullable="false" />
<Property Name="DeliveryTime" Type="datetime" Precision="0" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Precision="0" Nullable="false" />
<Property Name="CostPrice" Type="float" Nullable="false" />
<Property Name="TransactPrice" Type="float" Nullable="false" />
<Property Name="OrderStatus" Type="int" Nullable="false" />
<Property Name="Sn_Start" Type="varchar" MaxLength="11" />
<Property Name="Sn_End" Type="varchar" MaxLength="11" />
</EntityType>
<EntityType Name="TBL_ProductionLine">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="Description" Type="varchar" MaxLength="255" />
<Property Name="Remark" Type="varchar" MaxLength="255" />
</EntityType>
<EntityType Name="TBL_ProductionPlan">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrderID" Type="int" Nullable="false" />
<Property Name="ProductionLineID" Type="int" Nullable="false" />
<Property Name="OrderInternalID" Type="int" Nullable="false" />
<Property Name="StationID" Type="int" Nullable="false" />
<Property Name="ProductionTime" Type="datetime" Precision="0" Nullable="false" />
<Property Name="ActualOutput" Type="int" Nullable="false" />
<Property Name="ObjectiveYield" Type="int" Nullable="false" />
<Property Name="Remark" Type="varchar" MaxLength="255" />
<Property Name="Sn_Start" Type="varchar" MaxLength="255" />
<Property Name="Sn_End" Type="varchar" MaxLength="255" />
<Property Name="ObjectiveYieldTotal" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="TBL_Project">
<Key>
<PropertyRef Name="ProjectID" />
</Key>
<Property Name="ProjectID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ProjectName" Type="varchar" MaxLength="64" Nullable="false" />
<Property Name="Description" Type="varchar" MaxLength="64" />
<Property Name="UserID" Type="int" />
<Property Name="CreateTime" Type="datetime" Precision="0" />
<Property Name="Remark" Type="varchar" MaxLength="254" />
<Property Name="PreviewImage" Type="blob" />
<Property Name="Price" Type="float" />
<Property Name="Currency" Type="varchar" MaxLength="10" />
</EntityType>
<EntityType Name="TBL_SnList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrderID" Type="int" Nullable="false" />
<Property Name="OrderInternalID" Type="int" Nullable="false" />
<Property Name="ProductID" Type="int" Nullable="false" />
<Property Name="BarCode" Type="varchar" MaxLength="255" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Precision="0" Nullable="false" />
<Property Name="UseTime" Type="datetime" Precision="0" />
<Property Name="IsUse" Type="bool" Nullable="false" />
</EntityType>
<EntityType Name="TBL_SnRules">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrderID" Type="int" Nullable="false" />
<Property Name="OrderInternalID" Type="int" Nullable="false" />
<Property Name="ProductID" Type="int" Nullable="false" />
<Property Name="StationIDs" Type="varchar" MaxLength="255" Nullable="false" />
<Property Name="Sn_Prefix" Type="varchar" MaxLength="255" />
<Property Name="Sn_Start" Type="varchar" MaxLength="11" Nullable="false" />
<Property Name="Sn_End" Type="varchar" MaxLength="11" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Precision="0" Nullable="false" />
</EntityType>
<EntityType Name="TBL_StationList">
<Key>
<PropertyRef Name="StationID" />
</Key>
<Property Name="StationID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ProjectID" Type="int" Nullable="false" />
<Property Name="StationName" Type="varchar" MaxLength="255" Nullable="false" />
<Property Name="StationType" Type="varchar" MaxLength="255" Nullable="false" />
<Property Name="ArtworkOrder" Type="int" Nullable="false" />
<Property Name="StationDesc" Type="varchar" MaxLength="255" />
<Property Name="LastUpdateDate" Type="datetime" Precision="0" />
<Property Name="LogTableName" Type="varchar" MaxLength="255" />
<Property Name="BinPackage" Type="blob" />
<Property Name="BinPackageMd5" Type="varchar" MaxLength="255" />
<Property Name="PreviewImage" Type="blob" />
<Property Name="Remark" Type="varchar" MaxLength="255" />
<Property Name="PacketName" Type="varchar" MaxLength="255" />
</EntityType>
<EntityType Name="TBL_SyncList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CurrentDate" Type="datetime" Precision="0" />
<Property Name="TableName" Type="varchar" MaxLength="254" Nullable="false" />
<Property Name="RevisionID" Type="int" Nullable="false" />
<Property Name="SyncType" Type="varchar" MaxLength="254" />
</EntityType>
<EntityContainer Name="Uts_InHaosModelStoreContainer">
<EntitySet Name="TBL_Customer" EntityType="Self.TBL_Customer" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_FlowCtr" EntityType="Self.TBL_FlowCtr" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_Log" EntityType="Self.TBL_Log" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_OrderInternal" EntityType="Self.TBL_OrderInternal" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_Orders" EntityType="Self.TBL_Orders" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_ProductionLine" EntityType="Self.TBL_ProductionLine" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_ProductionPlan" EntityType="Self.TBL_ProductionPlan" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_Project" EntityType="Self.TBL_Project" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_SnList" EntityType="Self.TBL_SnList" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_SnRules" EntityType="Self.TBL_SnRules" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_StationList" EntityType="Self.TBL_StationList" Schema="uts_inhaos" store:Type="Tables" />
<EntitySet Name="TBL_SyncList" EntityType="Self.TBL_SyncList" Schema="uts_inhaos" store:Type="Tables" />
</EntityContainer>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="Uts_InHaosModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Uts_InHaosEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="TBL_Customer" EntityType="Uts_InHaosModel.TBL_Customer" />
<EntitySet Name="TBL_FlowCtr" EntityType="Uts_InHaosModel.TBL_FlowCtr" />
<EntitySet Name="TBL_Log" EntityType="Uts_InHaosModel.TBL_Log" />
<EntitySet Name="TBL_ProductionLine" EntityType="Uts_InHaosModel.TBL_ProductionLine" />
<EntitySet Name="TBL_Project" EntityType="Uts_InHaosModel.TBL_Project" />
<EntitySet Name="TBL_SyncList" EntityType="Uts_InHaosModel.TBL_SyncList" />
<EntitySet Name="TBL_StationList" EntityType="Uts_InHaosModel.TBL_StationList" />
<EntitySet Name="TBL_Orders" EntityType="Uts_InHaosModel.TBL_Orders" />
<EntitySet Name="TBL_ProductionPlan" EntityType="Uts_InHaosModel.TBL_ProductionPlan" />
<EntitySet Name="TBL_SnRules" EntityType="Uts_InHaosModel.TBL_SnRules" />
<EntitySet Name="TBL_OrderInternal" EntityType="Uts_InHaosModel.TBL_OrderInternal" />
<EntitySet Name="TBL_SnList" EntityType="Uts_InHaosModel.TBL_SnList" />
</EntityContainer>
<EntityType Name="TBL_Customer">
<Key>
<PropertyRef Name="CompanyID" />
</Key>
<Property Name="CompanyID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CustomerAbbr" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CustomerName" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" />
</EntityType>
<EntityType Name="TBL_FlowCtr">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ProjectID" Type="Int32" />
<Property Name="SUT_SN" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ProcessRecord" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_Log">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" />
<Property Name="UserID" Type="Int32" />
<Property Name="DateTime" Type="DateTime" />
<Property Name="Operation" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_ProductionLine">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="Description" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="Remark" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_Project">
<Key>
<PropertyRef Name="ProjectID" />
</Key>
<Property Name="ProjectID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ProjectName" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="Description" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="UserID" Type="Int32" />
<Property Name="CreateTime" Type="DateTime" />
<Property Name="Remark" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="PreviewImage" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="Price" Type="Single" />
<Property Name="Currency" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_SyncList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CurrentDate" Type="DateTime" />
<Property Name="TableName" Type="String" Nullable="false" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="RevisionID" Type="Int32" Nullable="false" />
<Property Name="SyncType" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_StationList">
<Key>
<PropertyRef Name="StationID" />
</Key>
<Property Name="StationID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ProjectID" Type="Int32" Nullable="false" />
<Property Name="StationName" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="StationType" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="ArtworkOrder" Type="Int32" Nullable="false" />
<Property Name="StationDesc" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="LastUpdateDate" Type="DateTime" />
<Property Name="LogTableName" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="BinPackage" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="BinPackageMd5" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="PreviewImage" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="Remark" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="PacketName" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_Orders">
<Key>
<PropertyRef Name="OrderID" />
</Key>
<Property Name="OrderID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CompanyID" Type="Int32" Nullable="false" />
<Property Name="ProductID" Type="Int32" Nullable="false" />
<Property Name="OrderNo" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="OrderCount" Type="Int32" Nullable="false" />
<Property Name="DeliveryTime" Type="DateTime" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" />
<Property Name="CostPrice" Type="Single" Nullable="false" />
<Property Name="TransactPrice" Type="Single" Nullable="false" />
<Property Name="OrderStatus" Type="Int32" Nullable="false" />
<Property Name="Sn_Start" Type="String" MaxLength="11" FixedLength="false" Unicode="false" />
<Property Name="Sn_End" Type="String" MaxLength="11" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_ProductionPlan">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrderID" Type="Int32" Nullable="false" />
<Property Name="ProductionLineID" Type="Int32" Nullable="false" />
<Property Name="ProductionTime" Type="DateTime" Nullable="false" />
<Property Name="ActualOutput" Type="Int32" Nullable="false" />
<Property Name="ObjectiveYield" Type="Int32" Nullable="false" />
<Property Name="Remark" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="Sn_Start" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="Sn_End" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="OrderInternalID" Type="Int32" Nullable="false" />
<Property Name="ObjectiveYieldTotal" Type="Int32" Nullable="false" />
<Property Name="StationID" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="TBL_SnRules">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrderID" Type="Int32" Nullable="false" />
<Property Name="OrderInternalID" Type="Int32" Nullable="false" />
<Property Name="ProductID" Type="Int32" Nullable="false" />
<Property Name="StationIDs" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="Sn_Prefix" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="Sn_Start" Type="String" Nullable="false" MaxLength="11" FixedLength="false" Unicode="false" />
<Property Name="Sn_End" Type="String" Nullable="false" MaxLength="11" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" />
</EntityType>
<EntityType Name="TBL_OrderInternal">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrderID" Type="Int32" Nullable="false" />
<Property Name="InternalNo" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" />
<Property Name="ObjectiveYield" Type="Int32" Nullable="false" />
<Property Name="ObjectiveYieldTotal" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="TBL_SnList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrderID" Type="Int32" Nullable="false" />
<Property Name="OrderInternalID" Type="Int32" Nullable="false" />
<Property Name="ProductID" Type="Int32" Nullable="false" />
<Property Name="BarCode" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" />
<Property Name="IsUse" Type="Boolean" Nullable="false" />
<Property Name="UseTime" Type="DateTime" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="Uts_InHaosModelStoreContainer" CdmEntityContainer="Uts_InHaosEntities">
<EntitySetMapping Name="TBL_Customer">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_Customer">
<MappingFragment StoreEntitySet="TBL_Customer">
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CustomerName" ColumnName="CustomerName" />
<ScalarProperty Name="CustomerAbbr" ColumnName="CustomerAbbr" />
<ScalarProperty Name="CompanyID" ColumnName="CompanyID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_FlowCtr">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_FlowCtr">
<MappingFragment StoreEntitySet="TBL_FlowCtr">
<ScalarProperty Name="ProcessRecord" ColumnName="ProcessRecord" />
<ScalarProperty Name="SUT_SN" ColumnName="SUT_SN" />
<ScalarProperty Name="ProjectID" ColumnName="ProjectID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_Log">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_Log">
<MappingFragment StoreEntitySet="TBL_Log">
<ScalarProperty Name="Operation" ColumnName="Operation" />
<ScalarProperty Name="DateTime" ColumnName="DateTime" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_ProductionLine">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_ProductionLine">
<MappingFragment StoreEntitySet="TBL_ProductionLine">
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="Description" ColumnName="Description" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_Project">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_Project">
<MappingFragment StoreEntitySet="TBL_Project">
<ScalarProperty Name="Currency" ColumnName="Currency" />
<ScalarProperty Name="Price" ColumnName="Price" />
<ScalarProperty Name="PreviewImage" ColumnName="PreviewImage" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
<ScalarProperty Name="Description" ColumnName="Description" />
<ScalarProperty Name="ProjectName" ColumnName="ProjectName" />
<ScalarProperty Name="ProjectID" ColumnName="ProjectID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_SyncList">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_SyncList">
<MappingFragment StoreEntitySet="TBL_SyncList">
<ScalarProperty Name="SyncType" ColumnName="SyncType" />
<ScalarProperty Name="RevisionID" ColumnName="RevisionID" />
<ScalarProperty Name="TableName" ColumnName="TableName" />
<ScalarProperty Name="CurrentDate" ColumnName="CurrentDate" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_StationList">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_StationList">
<MappingFragment StoreEntitySet="TBL_StationList">
<ScalarProperty Name="PacketName" ColumnName="PacketName" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="PreviewImage" ColumnName="PreviewImage" />
<ScalarProperty Name="BinPackageMd5" ColumnName="BinPackageMd5" />
<ScalarProperty Name="BinPackage" ColumnName="BinPackage" />
<ScalarProperty Name="LogTableName" ColumnName="LogTableName" />
<ScalarProperty Name="LastUpdateDate" ColumnName="LastUpdateDate" />
<ScalarProperty Name="StationDesc" ColumnName="StationDesc" />
<ScalarProperty Name="ArtworkOrder" ColumnName="ArtworkOrder" />
<ScalarProperty Name="StationType" ColumnName="StationType" />
<ScalarProperty Name="StationName" ColumnName="StationName" />
<ScalarProperty Name="ProjectID" ColumnName="ProjectID" />
<ScalarProperty Name="StationID" ColumnName="StationID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_Orders">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_Orders">
<MappingFragment StoreEntitySet="TBL_Orders">
<ScalarProperty Name="Sn_End" ColumnName="Sn_End" />
<ScalarProperty Name="Sn_Start" ColumnName="Sn_Start" />
<ScalarProperty Name="OrderStatus" ColumnName="OrderStatus" />
<ScalarProperty Name="TransactPrice" ColumnName="TransactPrice" />
<ScalarProperty Name="CostPrice" ColumnName="CostPrice" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="DeliveryTime" ColumnName="DeliveryTime" />
<ScalarProperty Name="OrderCount" ColumnName="OrderCount" />
<ScalarProperty Name="OrderNo" ColumnName="OrderNo" />
<ScalarProperty Name="ProductID" ColumnName="ProductID" />
<ScalarProperty Name="CompanyID" ColumnName="CompanyID" />
<ScalarProperty Name="OrderID" ColumnName="OrderID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_ProductionPlan">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_ProductionPlan">
<MappingFragment StoreEntitySet="TBL_ProductionPlan">
<ScalarProperty Name="StationID" ColumnName="StationID" />
<ScalarProperty Name="ObjectiveYieldTotal" ColumnName="ObjectiveYieldTotal" />
<ScalarProperty Name="OrderInternalID" ColumnName="OrderInternalID" />
<ScalarProperty Name="Sn_End" ColumnName="Sn_End" />
<ScalarProperty Name="Sn_Start" ColumnName="Sn_Start" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="ObjectiveYield" ColumnName="ObjectiveYield" />
<ScalarProperty Name="ActualOutput" ColumnName="ActualOutput" />
<ScalarProperty Name="ProductionTime" ColumnName="ProductionTime" />
<ScalarProperty Name="ProductionLineID" ColumnName="ProductionLineID" />
<ScalarProperty Name="OrderID" ColumnName="OrderID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_SnRules">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_SnRules">
<MappingFragment StoreEntitySet="TBL_SnRules">
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="Sn_End" ColumnName="Sn_End" />
<ScalarProperty Name="Sn_Start" ColumnName="Sn_Start" />
<ScalarProperty Name="Sn_Prefix" ColumnName="Sn_Prefix" />
<ScalarProperty Name="StationIDs" ColumnName="StationIDs" />
<ScalarProperty Name="ProductID" ColumnName="ProductID" />
<ScalarProperty Name="OrderInternalID" ColumnName="OrderInternalID" />
<ScalarProperty Name="OrderID" ColumnName="OrderID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_OrderInternal">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_OrderInternal">
<MappingFragment StoreEntitySet="TBL_OrderInternal">
<ScalarProperty Name="ObjectiveYieldTotal" ColumnName="ObjectiveYieldTotal" />
<ScalarProperty Name="ObjectiveYield" ColumnName="ObjectiveYield" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="InternalNo" ColumnName="InternalNo" />
<ScalarProperty Name="OrderID" ColumnName="OrderID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_SnList">
<EntityTypeMapping TypeName="Uts_InHaosModel.TBL_SnList">
<MappingFragment StoreEntitySet="TBL_SnList">
<ScalarProperty Name="UseTime" ColumnName="UseTime" />
<ScalarProperty Name="IsUse" ColumnName="IsUse" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="BarCode" ColumnName="BarCode" />
<ScalarProperty Name="ProductID" ColumnName="ProductID" />
<ScalarProperty Name="OrderInternalID" ColumnName="OrderInternalID" />
<ScalarProperty Name="OrderID" ColumnName="OrderID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="无" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="151a8c58f52a4202a3c014c3e9d5354a" Name="Diagram1">
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_Customer" Width="1.5" PointX="0.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_FlowCtr" Width="1.5" PointX="2.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_Log" Width="1.5" PointX="0.75" PointY="3.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_ProductionLine" Width="1.5" PointX="4.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_Project" Width="1.5" PointX="6.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_SyncList" Width="1.5" PointX="2.75" PointY="7.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_StationList" Width="1.5" PointX="7.375" PointY="7.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_Orders" Width="1.5" PointX="3.375" PointY="3.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_ProductionPlan" Width="1.5" PointX="9.375" PointY="0.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_SnRules" Width="1.5" PointX="9.375" PointY="8.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_OrderInternal" Width="1.5" PointX="5.375" PointY="4.75" />
<EntityTypeShape EntityType="Uts_InHaosModel.TBL_SnList" Width="1.5" PointX="9.375" PointY="4.75" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"InHaosEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Lodger
{
public int LodgerId { get; set; }
public string LodgerNmae { get; set; }
public string IDNumber { get; set; }
public Nullable<int> Sex { get; set; }
public Nullable<System.DateTime> CheckInDate { get; set; }
public int Sourcedian { get; set; }
public string phonenumber { get; set; }
public string remark { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class Uts_ManageEntities : DbContext
{
public Uts_ManageEntities()
: base("name=Uts_ManageEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<TBL_UTS_Manage_Company> TBL_UTS_Manage_Company { get; set; }
public virtual DbSet<TBL_UTS_Manage_DBList> TBL_UTS_Manage_DBList { get; set; }
public virtual DbSet<TBL_UTS_Manage_ErrCode> TBL_UTS_Manage_ErrCode { get; set; }
public virtual DbSet<TBL_UTS_Manage_OperationList> TBL_UTS_Manage_OperationList { get; set; }
public virtual DbSet<TBL_UTS_Manage_SwUpdate> TBL_UTS_Manage_SwUpdate { get; set; }
public virtual DbSet<TBL_UTS_Manage_SyncList> TBL_UTS_Manage_SyncList { get; set; }
public virtual DbSet<TBL_UTS_Manage_TestPlanTips> TBL_UTS_Manage_TestPlanTips { get; set; }
public virtual DbSet<TBL_UTS_Manage_UserAuth_Operation> TBL_UTS_Manage_UserAuth_Operation { get; set; }
public virtual DbSet<TBL_UTS_Manage_UtsCmdList> TBL_UTS_Manage_UtsCmdList { get; set; }
public virtual DbSet<TBL_UTS_Manage_ServiceLog> TBL_UTS_Manage_ServiceLog { get; set; }
public virtual DbSet<TBL_UTS_Manage_DataServiceLog> TBL_UTS_Manage_DataServiceLog { get; set; }
public virtual DbSet<TBL_UTS_Manage_DataServiceList> TBL_UTS_Manage_DataServiceList { get; set; }
public virtual DbSet<TBL_UTS_Manage_User> TBL_UTS_Manage_User { get; set; }
public virtual DbSet<TBL_UTS_Manage_SearchKey> TBL_UTS_Manage_SearchKey { get; set; }
public virtual DbSet<TBL_UTS_Manage_AppList> TBL_UTS_Manage_AppList { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"ManageEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,10 @@
// 为模型“E:\Face\Face\Face.Domain\Entities\ManageEntity.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时此属性会出现在
// “属性”窗口中。
// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
// 类,请在设计器中打开该模型,右键单击设计器图面,然后
// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
// 项...”。

View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -0,0 +1,750 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="Uts_ManageModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="TBL_UTS_Manage_AppList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ServiceID" Type="int" />
<Property Name="AppID" Type="int" />
<Property Name="AppName" Type="varchar" MaxLength="64" />
<Property Name="AppVersion" Type="varchar" MaxLength="32" />
<Property Name="RegisterDateTime" Type="datetime" Precision="0" />
<Property Name="LastActiveDateTime" Type="datetime" Precision="0" />
<Property Name="Remark" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_Company">
<Key>
<PropertyRef Name="CompanyID" />
</Key>
<Property Name="CompanyID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CustomerName" Type="varchar" MaxLength="64" />
<Property Name="CreateTime" Type="datetime" Precision="0" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DataServiceList">
<Key>
<PropertyRef Name="ServiceID" />
</Key>
<Property Name="ServiceID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="LicenseID" Type="int" />
<Property Name="LicenseValidDateTime" Type="varchar" MaxLength="254" />
<Property Name="CompanyName" Type="varchar" MaxLength="64" />
<Property Name="TerminalOS" Type="varchar" MaxLength="254" />
<Property Name="TerminalType" Type="varchar" MaxLength="64" />
<Property Name="TerminalName" Type="varchar" MaxLength="128" />
<Property Name="TerminalAlias" Type="varchar" MaxLength="128" />
<Property Name="TerminalMAC" Type="varchar" MaxLength="32" />
<Property Name="ServiceVersion" Type="varchar" MaxLength="32" />
<Property Name="ServiceRegisterDateTime" Type="timestamp" Precision="0" />
<Property Name="ServiceLastActiveDateTime" Type="timestamp" Precision="0" />
<Property Name="ServiceValid" Type="tinyint" />
<Property Name="IsOnline" Type="bool" Nullable="false" />
<Property Name="ServiceOnlineDateTime" Type="timestamp" Precision="0" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DataServiceLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ServiceID" Type="int" />
<Property Name="ServiceVersion" Type="varchar" MaxLength="64" />
<Property Name="UpdateServiceVersion" Type="varchar" MaxLength="64" />
<Property Name="VendorName" Type="varchar" MaxLength="254" />
<Property Name="DateTime" Type="datetime" Precision="0" />
<Property Name="PublicIp" Type="varchar" MaxLength="64" />
<Property Name="PrivateIp" Type="varchar" MaxLength="64" />
<Property Name="LogType" Type="varchar" MaxLength="32" />
<Property Name="LogText" Type="text" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DBList">
<Key>
<PropertyRef Name="DatabaseID" />
</Key>
<Property Name="DatabaseID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CompanyID" Type="varchar" MaxLength="254" />
<Property Name="DatabaseName" Type="varchar" MaxLength="64" />
<Property Name="DatabaseUser" Type="varchar" MaxLength="64" />
<Property Name="DatabasePassword" Type="varchar" MaxLength="64" />
<Property Name="DatabaseDesc" Type="varchar" MaxLength="64" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_ErrCode">
<Key>
<PropertyRef Name="ErrCode" />
</Key>
<Property Name="ErrCode" Type="varchar" MaxLength="254" Nullable="false" />
<Property Name="ErrMsg" Type="varchar" MaxLength="254" />
<Property Name="ErrColor" Type="int" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_OperationList">
<Key>
<PropertyRef Name="OperationID" />
</Key>
<Property Name="OperationID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OperationName" Type="varchar" MaxLength="254" />
<Property Name="OperationDesc" Type="varchar" MaxLength="254" />
<Property Name="OperationLevel" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SearchKey">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="DataBaseID" Type="int" Nullable="false" />
<Property Name="SearchVarKey" Type="varchar" MaxLength="64" Nullable="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_ServiceLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CompanyName" Type="varchar" MaxLength="254" />
<Property Name="AppName" Type="varchar" MaxLength="254" />
<Property Name="AppVersion" Type="varchar" MaxLength="254" />
<Property Name="DateTime" Type="datetime" Precision="0" />
<Property Name="DevPublicIP" Type="varchar" MaxLength="254" />
<Property Name="DevPrivateIP" Type="varchar" MaxLength="254" />
<Property Name="DevMac" Type="varchar" MaxLength="254" />
<Property Name="DevOS" Type="varchar" MaxLength="254" />
<Property Name="DevName" Type="varchar" MaxLength="254" />
<Property Name="DevUserName" Type="varchar" MaxLength="254" />
<Property Name="DevOnline" Type="varchar" MaxLength="254" />
<Property Name="LogType" Type="varchar" MaxLength="254" />
<Property Name="LogText" Type="text" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SwUpdate">
<Key>
<PropertyRef Name="SoftwareID" />
</Key>
<Property Name="SoftwareID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="SoftwareName" Type="varchar" MaxLength="254" />
<Property Name="LastVersion" Type="varchar" MaxLength="254" />
<Property Name="ReleaseDate" Type="datetime" Precision="0" />
<Property Name="BinPackage" Type="blob" />
<Property Name="BinPackageMd5" Type="varchar" MaxLength="254" />
<Property Name="PackageName" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SyncList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="TableName" Type="varchar" MaxLength="254" Nullable="false" />
<Property Name="RevisionID" Type="int" Nullable="false" />
<Property Name="SyncType" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_TestPlanTips">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="ColName" Type="varchar" MaxLength="254" />
<Property Name="ColType" Type="varchar" MaxLength="254" />
<Property Name="ColDesc" Type="varchar" MaxLength="254" />
<Property Name="ColValue" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_User">
<Key>
<PropertyRef Name="UserID" />
</Key>
<Property Name="UserID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CompanyID" Type="int" Nullable="false" />
<Property Name="UserName" Type="varchar" MaxLength="64" />
<Property Name="Password" Type="varchar" MaxLength="64" />
<Property Name="CreateTime" Type="datetime" Precision="0" />
<Property Name="Mobile" Type="varchar" MaxLength="64" />
<Property Name="WeiXin" Type="varchar" MaxLength="64" />
<Property Name="Email" Type="varchar" MaxLength="64" />
<Property Name="IsValid" Type="bool" Nullable="false" />
<Property Name="IsAdmin" Type="bool" Nullable="false" />
<Property Name="BarCode" Type="varchar" MaxLength="254" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_UserAuth_Operation">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="UserID" Type="int" Nullable="false" />
<Property Name="DatabaseID" Type="int" Nullable="false" />
<Property Name="DatabaseName" Type="varchar" MaxLength="255" />
<Property Name="FullAccess" Type="varchar" MaxLength="255" />
<Property Name="ReadWriteAccess" Type="varchar" MaxLength="255" />
<Property Name="ReadOnlyAccess" Type="varchar" MaxLength="255" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_UtsCmdList">
<Key>
<PropertyRef Name="CmdID" />
</Key>
<Property Name="CmdID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CmdType" Type="varchar" MaxLength="254" />
<Property Name="CmdName" Type="varchar" MaxLength="254" />
<Property Name="CmdDesc" Type="varchar" MaxLength="254" />
<Property Name="ParamCount" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc1" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc2" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc3" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc4" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc5" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc6" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc7" Type="varchar" MaxLength="254" />
<Property Name="ParamDesc8" Type="varchar" MaxLength="254" />
<Property Name="ParamType1" Type="varchar" MaxLength="254" />
<Property Name="ParamType2" Type="varchar" MaxLength="254" />
<Property Name="ParamType3" Type="varchar" MaxLength="254" />
<Property Name="ParamType4" Type="varchar" MaxLength="254" />
<Property Name="ParamType5" Type="varchar" MaxLength="254" />
<Property Name="ParamType6" Type="varchar" MaxLength="254" />
<Property Name="ParamType7" Type="varchar" MaxLength="254" />
<Property Name="ParamType8" Type="varchar" MaxLength="254" />
<Property Name="ParamLower1" Type="varchar" MaxLength="254" />
<Property Name="ParamLower2" Type="varchar" MaxLength="254" />
<Property Name="ParamLower3" Type="varchar" MaxLength="254" />
<Property Name="ParamLower4" Type="varchar" MaxLength="254" />
<Property Name="ParamLower5" Type="varchar" MaxLength="254" />
<Property Name="ParamLower6" Type="varchar" MaxLength="254" />
<Property Name="ParamLower7" Type="varchar" MaxLength="254" />
<Property Name="ParamLower8" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper1" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper2" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper3" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper4" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper5" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper6" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper7" Type="varchar" MaxLength="254" />
<Property Name="ParamUpper8" Type="varchar" MaxLength="254" />
<Property Name="ParamValue1" Type="varchar" MaxLength="254" />
<Property Name="ParamValue2" Type="varchar" MaxLength="254" />
<Property Name="ParamValue3" Type="varchar" MaxLength="254" />
<Property Name="ParamValue4" Type="varchar" MaxLength="254" />
<Property Name="ParamValue5" Type="varchar" MaxLength="254" />
<Property Name="ParamValue6" Type="varchar" MaxLength="254" />
<Property Name="ParamValue7" Type="varchar" MaxLength="254" />
<Property Name="ParamValue8" Type="varchar" MaxLength="254" />
</EntityType>
<EntityContainer Name="Uts_ManageModelStoreContainer">
<EntitySet Name="TBL_UTS_Manage_AppList" EntityType="Self.TBL_UTS_Manage_AppList" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_Company" EntityType="Self.TBL_UTS_Manage_Company" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_DataServiceList" EntityType="Self.TBL_UTS_Manage_DataServiceList" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_DataServiceLog" EntityType="Self.TBL_UTS_Manage_DataServiceLog" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_DBList" EntityType="Self.TBL_UTS_Manage_DBList" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_ErrCode" EntityType="Self.TBL_UTS_Manage_ErrCode" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_OperationList" EntityType="Self.TBL_UTS_Manage_OperationList" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_SearchKey" EntityType="Self.TBL_UTS_Manage_SearchKey" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_ServiceLog" EntityType="Self.TBL_UTS_Manage_ServiceLog" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_SwUpdate" EntityType="Self.TBL_UTS_Manage_SwUpdate" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_SyncList" EntityType="Self.TBL_UTS_Manage_SyncList" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_TestPlanTips" EntityType="Self.TBL_UTS_Manage_TestPlanTips" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_User" EntityType="Self.TBL_UTS_Manage_User" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_UserAuth_Operation" EntityType="Self.TBL_UTS_Manage_UserAuth_Operation" Schema="uts_manage" store:Type="Tables" />
<EntitySet Name="TBL_UTS_Manage_UtsCmdList" EntityType="Self.TBL_UTS_Manage_UtsCmdList" Schema="uts_manage" store:Type="Tables" />
</EntityContainer>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="Uts_ManageModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Uts_ManageEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="TBL_UTS_Manage_Company" EntityType="Uts_ManageModel.TBL_UTS_Manage_Company" />
<EntitySet Name="TBL_UTS_Manage_DBList" EntityType="Uts_ManageModel.TBL_UTS_Manage_DBList" />
<EntitySet Name="TBL_UTS_Manage_ErrCode" EntityType="Uts_ManageModel.TBL_UTS_Manage_ErrCode" />
<EntitySet Name="TBL_UTS_Manage_OperationList" EntityType="Uts_ManageModel.TBL_UTS_Manage_OperationList" />
<EntitySet Name="TBL_UTS_Manage_SwUpdate" EntityType="Uts_ManageModel.TBL_UTS_Manage_SwUpdate" />
<EntitySet Name="TBL_UTS_Manage_SyncList" EntityType="Uts_ManageModel.TBL_UTS_Manage_SyncList" />
<EntitySet Name="TBL_UTS_Manage_TestPlanTips" EntityType="Uts_ManageModel.TBL_UTS_Manage_TestPlanTips" />
<EntitySet Name="TBL_UTS_Manage_UserAuth_Operation" EntityType="Uts_ManageModel.TBL_UTS_Manage_UserAuth_Operation" />
<EntitySet Name="TBL_UTS_Manage_UtsCmdList" EntityType="Uts_ManageModel.TBL_UTS_Manage_UtsCmdList" />
<EntitySet Name="TBL_UTS_Manage_ServiceLog" EntityType="Uts_ManageModel.TBL_UTS_Manage_ServiceLog" />
<EntitySet Name="TBL_UTS_Manage_DataServiceLog" EntityType="Uts_ManageModel.TBL_UTS_Manage_DataServiceLog" />
<EntitySet Name="TBL_UTS_Manage_DataServiceList" EntityType="Uts_ManageModel.TBL_UTS_Manage_DataServiceList" />
<EntitySet Name="TBL_UTS_Manage_User" EntityType="Uts_ManageModel.TBL_UTS_Manage_User" />
<EntitySet Name="TBL_UTS_Manage_SearchKey" EntityType="Uts_ManageModel.TBL_UTS_Manage_SearchKey" />
<EntitySet Name="TBL_UTS_Manage_AppList" EntityType="Uts_ManageModel.TBL_UTS_Manage_AppList" />
</EntityContainer>
<EntityType Name="TBL_UTS_Manage_Company">
<Key>
<PropertyRef Name="CompanyID" />
</Key>
<Property Name="CompanyID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CustomerName" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DBList">
<Key>
<PropertyRef Name="DatabaseID" />
</Key>
<Property Name="DatabaseID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="DatabaseName" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="DatabaseUser" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="DatabasePassword" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="DatabaseDesc" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CompanyID" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_ErrCode">
<Key>
<PropertyRef Name="ErrCode" />
</Key>
<Property Name="ErrCode" Type="String" Nullable="false" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ErrMsg" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ErrColor" Type="Int32" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_OperationList">
<Key>
<PropertyRef Name="OperationID" />
</Key>
<Property Name="OperationID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OperationName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="OperationDesc" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="OperationLevel" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SwUpdate">
<Key>
<PropertyRef Name="SoftwareID" />
</Key>
<Property Name="SoftwareID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="SoftwareName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="LastVersion" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ReleaseDate" Type="DateTime" />
<Property Name="BinPackage" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="BinPackageMd5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="PackageName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SyncList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="TableName" Type="String" Nullable="false" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="RevisionID" Type="Int32" Nullable="false" />
<Property Name="SyncType" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_TestPlanTips">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ColName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ColType" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ColDesc" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ColValue" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_UserAuth_Operation">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="UserID" Type="Int32" Nullable="false" />
<Property Name="DatabaseID" Type="Int32" Nullable="false" />
<Property Name="DatabaseName" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="FullAccess" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="ReadWriteAccess" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
<Property Name="ReadOnlyAccess" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_UtsCmdList">
<Key>
<PropertyRef Name="CmdID" />
</Key>
<Property Name="CmdID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CmdType" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="CmdName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="CmdDesc" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamCount" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc1" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc2" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc3" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc4" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc6" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc7" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamDesc8" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType1" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType2" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType3" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType4" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType6" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType7" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamType8" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower1" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower2" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower3" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower4" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower6" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower7" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamLower8" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper1" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper2" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper3" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper4" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper6" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper7" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamUpper8" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue1" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue2" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue3" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue4" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue6" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue7" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="ParamValue8" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_ServiceLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AppName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DateTime" Type="DateTime" />
<Property Name="DevPublicIP" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevPrivateIP" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevMac" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevOS" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevUserName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DevOnline" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="LogType" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="LogText" Type="String" MaxLength="2048" FixedLength="false" Unicode="false" />
<Property Name="CompanyName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="AppVersion" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DataServiceLog">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ServiceID" Type="Int32" />
<Property Name="ServiceVersion" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="UpdateServiceVersion" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="VendorName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="DateTime" Type="DateTime" />
<Property Name="PublicIp" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="PrivateIp" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="LogType" Type="String" MaxLength="32" FixedLength="false" Unicode="false" />
<Property Name="LogText" Type="String" MaxLength="65535" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_DataServiceList">
<Key>
<PropertyRef Name="ServiceID" />
</Key>
<Property Name="ServiceID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="LicenseID" Type="Int32" />
<Property Name="LicenseValidDateTime" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="CompanyName" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="TerminalOS" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="TerminalType" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="TerminalName" Type="String" MaxLength="128" FixedLength="false" Unicode="false" />
<Property Name="TerminalMAC" Type="String" MaxLength="32" FixedLength="false" Unicode="false" />
<Property Name="ServiceVersion" Type="String" MaxLength="32" FixedLength="false" Unicode="false" />
<Property Name="ServiceRegisterDateTime" Type="DateTime" />
<Property Name="ServiceLastActiveDateTime" Type="DateTime" />
<Property Name="ServiceValid" Type="SByte" />
<Property Name="IsOnline" Type="Boolean" Nullable="false" />
<Property Name="TerminalAlias" Type="String" MaxLength="128" FixedLength="false" Unicode="false" />
<Property Name="ServiceOnlineDateTime" Type="DateTime" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_User">
<Key>
<PropertyRef Name="UserID" />
</Key>
<Property Name="UserID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CompanyID" Type="Int32" Nullable="false" />
<Property Name="UserName" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="Password" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="CreateTime" Type="DateTime" />
<Property Name="Mobile" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="WeiXin" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="Email" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="IsValid" Type="Boolean" Nullable="false" />
<Property Name="IsAdmin" Type="Boolean" Nullable="false" />
<Property Name="BarCode" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_SearchKey">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="DataBaseID" Type="Int32" Nullable="false" />
<Property Name="SearchVarKey" Type="String" Nullable="false" MaxLength="64" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="TBL_UTS_Manage_AppList">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ServiceID" Type="Int32" />
<Property Name="AppID" Type="Int32" />
<Property Name="AppName" Type="String" MaxLength="64" FixedLength="false" Unicode="false" />
<Property Name="AppVersion" Type="String" MaxLength="32" FixedLength="false" Unicode="false" />
<Property Name="RegisterDateTime" Type="DateTime" />
<Property Name="LastActiveDateTime" Type="DateTime" />
<Property Name="Remark" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="Uts_ManageModelStoreContainer" CdmEntityContainer="Uts_ManageEntities">
<EntitySetMapping Name="TBL_UTS_Manage_Company">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_Company">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_Company">
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CustomerName" ColumnName="CustomerName" />
<ScalarProperty Name="CompanyID" ColumnName="CompanyID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_DBList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_DBList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_DBList">
<ScalarProperty Name="CompanyID" ColumnName="CompanyID" />
<ScalarProperty Name="DatabaseDesc" ColumnName="DatabaseDesc" />
<ScalarProperty Name="DatabasePassword" ColumnName="DatabasePassword" />
<ScalarProperty Name="DatabaseUser" ColumnName="DatabaseUser" />
<ScalarProperty Name="DatabaseName" ColumnName="DatabaseName" />
<ScalarProperty Name="DatabaseID" ColumnName="DatabaseID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_ErrCode">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_ErrCode">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_ErrCode">
<ScalarProperty Name="ErrColor" ColumnName="ErrColor" />
<ScalarProperty Name="ErrMsg" ColumnName="ErrMsg" />
<ScalarProperty Name="ErrCode" ColumnName="ErrCode" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_OperationList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_OperationList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_OperationList">
<ScalarProperty Name="OperationLevel" ColumnName="OperationLevel" />
<ScalarProperty Name="OperationDesc" ColumnName="OperationDesc" />
<ScalarProperty Name="OperationName" ColumnName="OperationName" />
<ScalarProperty Name="OperationID" ColumnName="OperationID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_SwUpdate">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_SwUpdate">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_SwUpdate">
<ScalarProperty Name="PackageName" ColumnName="PackageName" />
<ScalarProperty Name="BinPackageMd5" ColumnName="BinPackageMd5" />
<ScalarProperty Name="BinPackage" ColumnName="BinPackage" />
<ScalarProperty Name="ReleaseDate" ColumnName="ReleaseDate" />
<ScalarProperty Name="LastVersion" ColumnName="LastVersion" />
<ScalarProperty Name="SoftwareName" ColumnName="SoftwareName" />
<ScalarProperty Name="SoftwareID" ColumnName="SoftwareID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_SyncList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_SyncList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_SyncList">
<ScalarProperty Name="SyncType" ColumnName="SyncType" />
<ScalarProperty Name="RevisionID" ColumnName="RevisionID" />
<ScalarProperty Name="TableName" ColumnName="TableName" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_TestPlanTips">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_TestPlanTips">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_TestPlanTips">
<ScalarProperty Name="ColValue" ColumnName="ColValue" />
<ScalarProperty Name="ColDesc" ColumnName="ColDesc" />
<ScalarProperty Name="ColType" ColumnName="ColType" />
<ScalarProperty Name="ColName" ColumnName="ColName" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_UserAuth_Operation">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_UserAuth_Operation">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_UserAuth_Operation">
<ScalarProperty Name="ReadOnlyAccess" ColumnName="ReadOnlyAccess" />
<ScalarProperty Name="ReadWriteAccess" ColumnName="ReadWriteAccess" />
<ScalarProperty Name="FullAccess" ColumnName="FullAccess" />
<ScalarProperty Name="DatabaseName" ColumnName="DatabaseName" />
<ScalarProperty Name="DatabaseID" ColumnName="DatabaseID" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_UtsCmdList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_UtsCmdList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_UtsCmdList">
<ScalarProperty Name="ParamValue8" ColumnName="ParamValue8" />
<ScalarProperty Name="ParamValue7" ColumnName="ParamValue7" />
<ScalarProperty Name="ParamValue6" ColumnName="ParamValue6" />
<ScalarProperty Name="ParamValue5" ColumnName="ParamValue5" />
<ScalarProperty Name="ParamValue4" ColumnName="ParamValue4" />
<ScalarProperty Name="ParamValue3" ColumnName="ParamValue3" />
<ScalarProperty Name="ParamValue2" ColumnName="ParamValue2" />
<ScalarProperty Name="ParamValue1" ColumnName="ParamValue1" />
<ScalarProperty Name="ParamUpper8" ColumnName="ParamUpper8" />
<ScalarProperty Name="ParamUpper7" ColumnName="ParamUpper7" />
<ScalarProperty Name="ParamUpper6" ColumnName="ParamUpper6" />
<ScalarProperty Name="ParamUpper5" ColumnName="ParamUpper5" />
<ScalarProperty Name="ParamUpper4" ColumnName="ParamUpper4" />
<ScalarProperty Name="ParamUpper3" ColumnName="ParamUpper3" />
<ScalarProperty Name="ParamUpper2" ColumnName="ParamUpper2" />
<ScalarProperty Name="ParamUpper1" ColumnName="ParamUpper1" />
<ScalarProperty Name="ParamLower8" ColumnName="ParamLower8" />
<ScalarProperty Name="ParamLower7" ColumnName="ParamLower7" />
<ScalarProperty Name="ParamLower6" ColumnName="ParamLower6" />
<ScalarProperty Name="ParamLower5" ColumnName="ParamLower5" />
<ScalarProperty Name="ParamLower4" ColumnName="ParamLower4" />
<ScalarProperty Name="ParamLower3" ColumnName="ParamLower3" />
<ScalarProperty Name="ParamLower2" ColumnName="ParamLower2" />
<ScalarProperty Name="ParamLower1" ColumnName="ParamLower1" />
<ScalarProperty Name="ParamType8" ColumnName="ParamType8" />
<ScalarProperty Name="ParamType7" ColumnName="ParamType7" />
<ScalarProperty Name="ParamType6" ColumnName="ParamType6" />
<ScalarProperty Name="ParamType5" ColumnName="ParamType5" />
<ScalarProperty Name="ParamType4" ColumnName="ParamType4" />
<ScalarProperty Name="ParamType3" ColumnName="ParamType3" />
<ScalarProperty Name="ParamType2" ColumnName="ParamType2" />
<ScalarProperty Name="ParamType1" ColumnName="ParamType1" />
<ScalarProperty Name="ParamDesc8" ColumnName="ParamDesc8" />
<ScalarProperty Name="ParamDesc7" ColumnName="ParamDesc7" />
<ScalarProperty Name="ParamDesc6" ColumnName="ParamDesc6" />
<ScalarProperty Name="ParamDesc5" ColumnName="ParamDesc5" />
<ScalarProperty Name="ParamDesc4" ColumnName="ParamDesc4" />
<ScalarProperty Name="ParamDesc3" ColumnName="ParamDesc3" />
<ScalarProperty Name="ParamDesc2" ColumnName="ParamDesc2" />
<ScalarProperty Name="ParamDesc1" ColumnName="ParamDesc1" />
<ScalarProperty Name="ParamCount" ColumnName="ParamCount" />
<ScalarProperty Name="CmdDesc" ColumnName="CmdDesc" />
<ScalarProperty Name="CmdName" ColumnName="CmdName" />
<ScalarProperty Name="CmdType" ColumnName="CmdType" />
<ScalarProperty Name="CmdID" ColumnName="CmdID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_ServiceLog">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_ServiceLog">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_ServiceLog">
<ScalarProperty Name="AppVersion" ColumnName="AppVersion" />
<ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
<ScalarProperty Name="LogText" ColumnName="LogText" />
<ScalarProperty Name="LogType" ColumnName="LogType" />
<ScalarProperty Name="DevOnline" ColumnName="DevOnline" />
<ScalarProperty Name="DevUserName" ColumnName="DevUserName" />
<ScalarProperty Name="DevName" ColumnName="DevName" />
<ScalarProperty Name="DevOS" ColumnName="DevOS" />
<ScalarProperty Name="DevMac" ColumnName="DevMac" />
<ScalarProperty Name="DevPrivateIP" ColumnName="DevPrivateIP" />
<ScalarProperty Name="DevPublicIP" ColumnName="DevPublicIP" />
<ScalarProperty Name="DateTime" ColumnName="DateTime" />
<ScalarProperty Name="AppName" ColumnName="AppName" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_DataServiceLog">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_DataServiceLog">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_DataServiceLog">
<ScalarProperty Name="LogText" ColumnName="LogText" />
<ScalarProperty Name="LogType" ColumnName="LogType" />
<ScalarProperty Name="PrivateIp" ColumnName="PrivateIp" />
<ScalarProperty Name="PublicIp" ColumnName="PublicIp" />
<ScalarProperty Name="DateTime" ColumnName="DateTime" />
<ScalarProperty Name="VendorName" ColumnName="VendorName" />
<ScalarProperty Name="UpdateServiceVersion" ColumnName="UpdateServiceVersion" />
<ScalarProperty Name="ServiceVersion" ColumnName="ServiceVersion" />
<ScalarProperty Name="ServiceID" ColumnName="ServiceID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_DataServiceList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_DataServiceList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_DataServiceList">
<ScalarProperty Name="ServiceOnlineDateTime" ColumnName="ServiceOnlineDateTime" />
<ScalarProperty Name="TerminalAlias" ColumnName="TerminalAlias" />
<ScalarProperty Name="IsOnline" ColumnName="IsOnline" />
<ScalarProperty Name="ServiceValid" ColumnName="ServiceValid" />
<ScalarProperty Name="ServiceLastActiveDateTime" ColumnName="ServiceLastActiveDateTime" />
<ScalarProperty Name="ServiceRegisterDateTime" ColumnName="ServiceRegisterDateTime" />
<ScalarProperty Name="ServiceVersion" ColumnName="ServiceVersion" />
<ScalarProperty Name="TerminalMAC" ColumnName="TerminalMAC" />
<ScalarProperty Name="TerminalName" ColumnName="TerminalName" />
<ScalarProperty Name="TerminalType" ColumnName="TerminalType" />
<ScalarProperty Name="TerminalOS" ColumnName="TerminalOS" />
<ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
<ScalarProperty Name="LicenseValidDateTime" ColumnName="LicenseValidDateTime" />
<ScalarProperty Name="LicenseID" ColumnName="LicenseID" />
<ScalarProperty Name="ServiceID" ColumnName="ServiceID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_User">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_User">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_User">
<ScalarProperty Name="BarCode" ColumnName="BarCode" />
<ScalarProperty Name="IsAdmin" ColumnName="IsAdmin" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
<ScalarProperty Name="Email" ColumnName="Email" />
<ScalarProperty Name="WeiXin" ColumnName="WeiXin" />
<ScalarProperty Name="Mobile" ColumnName="Mobile" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="Password" ColumnName="Password" />
<ScalarProperty Name="UserName" ColumnName="UserName" />
<ScalarProperty Name="CompanyID" ColumnName="CompanyID" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_SearchKey">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_SearchKey">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_SearchKey">
<ScalarProperty Name="SearchVarKey" ColumnName="SearchVarKey" />
<ScalarProperty Name="DataBaseID" ColumnName="DataBaseID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_UTS_Manage_AppList">
<EntityTypeMapping TypeName="Uts_ManageModel.TBL_UTS_Manage_AppList">
<MappingFragment StoreEntitySet="TBL_UTS_Manage_AppList">
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="LastActiveDateTime" ColumnName="LastActiveDateTime" />
<ScalarProperty Name="RegisterDateTime" ColumnName="RegisterDateTime" />
<ScalarProperty Name="AppVersion" ColumnName="AppVersion" />
<ScalarProperty Name="AppName" ColumnName="AppName" />
<ScalarProperty Name="AppID" ColumnName="AppID" />
<ScalarProperty Name="ServiceID" ColumnName="ServiceID" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="无" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="60616cae545046229af779a4fe88eb80" Name="Diagram1">
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_Company" Width="1.5" PointX="0.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_DBList" Width="1.5" PointX="2.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_ErrCode" Width="1.5" PointX="4.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_OperationList" Width="1.5" PointX="6.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_SwUpdate" Width="1.5" PointX="6.75" PointY="3.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_SyncList" Width="1.5" PointX="4.75" PointY="6.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_TestPlanTips" Width="1.5" PointX="6.75" PointY="6.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_UserAuth_Operation" Width="1.5" PointX="8.75" PointY="0.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_UtsCmdList" Width="1.5" PointX="8.75" PointY="4.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_ServiceLog" Width="1.5" PointX="3.375" PointY="9.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_DataServiceLog" Width="1.5" PointX="0.75" PointY="3.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_DataServiceList" Width="1.5" PointX="5.375" PointY="9.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_User" Width="1.5" PointX="0.75" PointY="7.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_SearchKey" Width="1.5" PointX="3.375" PointY="3.75" />
<EntityTypeShape EntityType="Uts_ManageModel.TBL_UTS_Manage_AppList" Width="1.5" PointX="11.375" PointY="0.75" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"ManageEntity.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Operator
{
public int Operatorid { get; set; }
public string name { get; set; }
public string pwd { get; set; }
public int companyid { get; set; }
public int mobile { get; set; }
public string tencentAI { get; set; }
public System.DateTime createdate { get; set; }
public bool Isenabled { get; set; }
public int Operatorlistid { get; set; }
public string Operatorimg { get; set; }
public virtual Operator Operator1 { get; set; }
public virtual Operator Operator2 { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class OperatorLog
{
public System.DateTime ologdate { get; set; }
public int Operatorid { get; set; }
public string Browsertype { get; set; }
public string ipaddress { get; set; }
public string operationtype { get; set; }
public string operatingdata { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class OperatorrList
{
public int Operatorlistid { get; set; }
public string Operatorlistname { get; set; }
public string Operatorlistremark { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class OrgAuthority
{
public int OrgId { get; set; }
public int AuthorityId { get; set; }
public int HotelId { get; set; }
public int Id { get; set; }
public int AuthotypeId { get; set; }
public Nullable<System.DateTime> CreateTime { get; set; }
public string CreatedBy { get; set; }
public virtual Authority Authority { get; set; }
public virtual AuthoStatusType AuthoStatusType { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class ROOM
{
public int houseid { get; set; }
public string housename { get; set; }
public int hotelid { get; set; }
}
}

View File

@@ -0,0 +1,121 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web.Services.Description;
namespace Face.Domain.Entities
{
public static class SqlSugarBase
{
public static SqlSugarClient GesmartDb()
{
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=Face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
DbType = SqlSugar.DbType.MySql,
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
});
//用来打印Sql方便调式
Db.Aop.OnLogExecuting = (sql, pars) =>
{
Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
Debug.WriteLine(sql);
};
return Db;
}
public static SqlSugarClient Gesmartblv_rcu_db()
{
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=blv_rcu_db;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",//数据库连接串
DbType = SqlSugar.DbType.MySql,
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
});
//用来打印Sql方便调式
Db.Aop.OnLogExecuting = (sql, pars) =>
{
Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
};
return Db;
}
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
IsAutoCloseConnection = true,
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=Face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
},
db =>
{
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
public static SqlSugarScope authoriydb = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
IsAutoCloseConnection = true,
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=AuthorityDB;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\Faces\Face.Web\bin\Face.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("Face.Domain.Application.FaceAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
// db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
///巫工数据库
public static SqlSugarScope WuDb = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.SqlServer,
IsAutoCloseConnection = true,
ConnectionString = "Data Source=pms.boonlive-rcu.com;Initial Catalog=RICS_WS;User ID=blw;Password=blw@123",
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\Faces\Face.Web\bin\Face.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("Face.Domain.Application.FaceAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
// db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
}
}

View File

@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class hfEntities : DbContext
{
public hfEntities()
: base("name=hfEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<C__MigrationHistory> C__MigrationHistory { get; set; }
public virtual DbSet<DbLog> DbLog { get; set; }
public virtual DbSet<AppAutho> AppAutho { get; set; }
public virtual DbSet<Authority> Authority { get; set; }
public virtual DbSet<AuthoStatusType> AuthoStatusType { get; set; }
public virtual DbSet<Hosts> Hosts { get; set; }
public virtual DbSet<HotelGroups> HotelGroups { get; set; }
public virtual DbSet<Hotels> Hotels { get; set; }
public virtual DbSet<TBL_Multilingual> TBL_Multilingual { get; set; }
public virtual DbSet<TBL_MultilingualApps> TBL_MultilingualApps { get; set; }
public virtual DbSet<TBL_MultilingualData> TBL_MultilingualData { get; set; }
public virtual DbSet<TBL_RCU_InfraredPacket> TBL_RCU_InfraredPacket { get; set; }
public virtual DbSet<UserAuthoes> UserAuthoes { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"SumInfoModel.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,10 @@
// 为模型“D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\Faces\Face.Domain\Entities\SumInfoModel.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时此属性会出现在
// “属性”窗口中。
// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
// 类,请在设计器中打开该模型,右键单击设计器图面,然后
// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
// 项...”。

View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -0,0 +1,935 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="hfModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="__MigrationHistory">
<Key>
<PropertyRef Name="MigrationId" />
</Key>
<Property Name="MigrationId" Type="nvarchar" MaxLength="150" Nullable="false" />
<Property Name="ContextKey" Type="nvarchar" MaxLength="300" Nullable="false" />
<Property Name="Model" Type="varbinary(max)" Nullable="false" />
<Property Name="ProductVersion" Type="nvarchar" MaxLength="32" Nullable="false" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.AppAutho”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="AppAutho">
<Key>
<PropertyRef Name="AppId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="Id" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="AppId" Type="int" Nullable="false" />
<Property Name="AuthorityId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.ApplicationDomain”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="ApplicationDomain">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="AppName" />
<PropertyRef Name="IsValid" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AppName" Type="nvarchar(max)" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="nvarchar(max)" />
<Property Name="IsValid" Type="int" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.Authority”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="Authority">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="AuthorityName" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AuthorityName" Type="nvarchar(max)" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
<Property Name="IsValid" Type="int" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.AuthoStatusType”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="AuthoStatusType">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Name" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<EntityType Name="DbLog">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Content" Type="nvarchar(max)" />
<Property Name="Uid" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="Type" Type="int" Nullable="false" />
<Property Name="Ip" Type="nvarchar" MaxLength="50" />
<Property Name="Client" Type="nvarchar(max)" />
<Property Name="location" Type="nvarchar" MaxLength="150" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.Hosts”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="Hosts">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="HotelID" />
<PropertyRef Name="Status" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="HotelID" Type="int" Nullable="false" />
<Property Name="RoomNumber" Type="nvarchar(max)" />
<Property Name="Status" Type="int" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="RoomStatusID" Type="int" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.HotelGroups”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="HotelGroups">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="ParentId" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" />
<Property Name="ParentId" Type="int" Nullable="false" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.Hotels”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="Hotels">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="GroupId" />
<PropertyRef Name="Status" />
<PropertyRef Name="IsApprove" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="GroupId" Type="int" Nullable="false" />
<Property Name="Code" Type="int" />
<Property Name="Status" Type="int" Nullable="false" />
<Property Name="IsApprove" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
</EntityType>
<EntityType Name="Organization">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrganizationName" Type="nvarchar(max)" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="IsDefault" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="datetime" Nullable="false" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
<Property Name="IsValid" Type="int" Nullable="false" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.OrgUsers”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="OrgUsers">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="Id" />
<PropertyRef Name="OrgId" />
</Key>
<Property Name="UserId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="OrgId" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="datetime" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.TBL_Multilingual”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_Multilingual">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Language" Type="nvarchar" MaxLength="254" />
<Property Name="ApplicationID" Type="nvarchar" MaxLength="254" />
<Property Name="Version" Type="nvarchar" MaxLength="254" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.TBL_MultilingualApps”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_MultilingualApps">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Application" Type="nvarchar" MaxLength="254" />
<Property Name="Remark" Type="nvarchar" MaxLength="254" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.TBL_MultilingualData”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_MultilingualData">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Chinese" Type="nvarchar" MaxLength="254" />
<Property Name="English" Type="nvarchar" MaxLength="254" />
<Property Name="ApplicationID" Type="nvarchar" MaxLength="254" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.TBL_RCU_InfraredPacket”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="TBL_RCU_InfraredPacket">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Type" Type="varchar" MaxLength="254" />
<Property Name="Brand" Type="varchar" MaxLength="254" />
<Property Name="Model" Type="varchar" MaxLength="254" />
<Property Name="Version" Type="varchar" MaxLength="254" />
<Property Name="CreateDate" Type="datetime" />
<Property Name="PacketName" Type="varchar" MaxLength="254" />
<Property Name="PacketData" Type="image" />
<Property Name="PacketMD5" Type="varchar" MaxLength="254" />
<Property Name="Remark" Type="text" />
<Property Name="OldPacket" Type="bit" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.UserAuthoes”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="UserAuthoes">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
<PropertyRef Name="Id" />
<PropertyRef Name="AuthotypeId" />
</Key>
<Property Name="UserId" Type="int" Nullable="false" />
<Property Name="AuthorityId" Type="int" Nullable="false" />
<Property Name="HotelId" Type="int" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="AuthotypeId" Type="int" Nullable="false" />
<Property Name="CreateTime" Type="nvarchar(max)" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
</EntityType>
<!--生成过程中发现错误:
警告 6002: 表/视图“hf.dbo.UserInfo”未定义主键。已推断出该键并将定义创建为只读的表/视图。-->
<EntityType Name="UserInfo">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Uid" />
<PropertyRef Name="Pwd" />
<PropertyRef Name="HeadImg" />
<PropertyRef Name="Sex" />
<PropertyRef Name="IsImport" />
</Key>
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Uid" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="Pwd" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="PwdSee" Type="nvarchar(max)" />
<Property Name="HeadImg" Type="nvarchar(max)" Nullable="false" />
<Property Name="Sex" Type="int" Nullable="false" />
<Property Name="Age" Type="int" />
<Property Name="IsValid" Type="int" />
<Property Name="Desc" Type="nvarchar(max)" />
<Property Name="CreateTime" Type="datetime" />
<Property Name="CreatedBy" Type="nvarchar(max)" />
<Property Name="HotelID" Type="int" />
<Property Name="HotelGroupID" Type="int" />
<Property Name="IsImport" Type="int" Nullable="false" />
<Property Name="Company" Type="int" />
</EntityType>
<Association Name="FK_dbo_OrgUsers_dbo_Organization_OrgId">
<End Role="Organization" Type="Self.Organization" Multiplicity="1" />
<End Role="OrgUsers" Type="Self.OrgUsers" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Organization">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgUsers">
<PropertyRef Name="OrgId" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="hfModelStoreContainer">
<EntitySet Name="__MigrationHistory" EntityType="Self.__MigrationHistory" Schema="dbo" store:Type="Tables" />
<EntitySet Name="DbLog" EntityType="Self.DbLog" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Organization" EntityType="Self.Organization" Schema="dbo" store:Type="Tables" />
<EntitySet Name="AppAutho" EntityType="Self.AppAutho" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[AppAutho].[AppId] AS [AppId],
[AppAutho].[AuthorityId] AS [AuthorityId],
[AppAutho].[Id] AS [Id],
[AppAutho].[CreateTime] AS [CreateTime],
[AppAutho].[CreatedBy] AS [CreatedBy]
FROM [dbo].[AppAutho] AS [AppAutho]</DefiningQuery>
</EntitySet>
<EntitySet Name="ApplicationDomain" EntityType="Self.ApplicationDomain" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[ApplicationDomain].[Id] AS [Id],
[ApplicationDomain].[AppName] AS [AppName],
[ApplicationDomain].[Desc] AS [Desc],
[ApplicationDomain].[CreateTime] AS [CreateTime],
[ApplicationDomain].[IsValid] AS [IsValid],
[ApplicationDomain].[CreatedBy] AS [CreatedBy]
FROM [dbo].[ApplicationDomain] AS [ApplicationDomain]</DefiningQuery>
</EntitySet>
<EntitySet Name="Authority" EntityType="Self.Authority" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[Authority].[Id] AS [Id],
[Authority].[AuthorityName] AS [AuthorityName],
[Authority].[Desc] AS [Desc],
[Authority].[CreateTime] AS [CreateTime],
[Authority].[CreatedBy] AS [CreatedBy],
[Authority].[IsValid] AS [IsValid]
FROM [dbo].[Authority] AS [Authority]</DefiningQuery>
</EntitySet>
<EntitySet Name="AuthoStatusType" EntityType="Self.AuthoStatusType" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[AuthoStatusType].[Id] AS [Id],
[AuthoStatusType].[Name] AS [Name],
[AuthoStatusType].[Desc] AS [Desc],
[AuthoStatusType].[CreateTime] AS [CreateTime],
[AuthoStatusType].[CreatedBy] AS [CreatedBy]
FROM [dbo].[AuthoStatusType] AS [AuthoStatusType]</DefiningQuery>
</EntitySet>
<EntitySet Name="Hosts" EntityType="Self.Hosts" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[Hosts].[Id] AS [Id],
[Hosts].[HotelID] AS [HotelID],
[Hosts].[RoomNumber] AS [RoomNumber],
[Hosts].[Status] AS [Status],
[Hosts].[Desc] AS [Desc],
[Hosts].[CreateTime] AS [CreateTime],
[Hosts].[RoomStatusID] AS [RoomStatusID]
FROM [dbo].[Hosts] AS [Hosts]</DefiningQuery>
</EntitySet>
<EntitySet Name="HotelGroups" EntityType="Self.HotelGroups" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[HotelGroups].[Id] AS [Id],
[HotelGroups].[Name] AS [Name],
[HotelGroups].[ParentId] AS [ParentId],
[HotelGroups].[Desc] AS [Desc],
[HotelGroups].[CreateTime] AS [CreateTime]
FROM [dbo].[HotelGroups] AS [HotelGroups]</DefiningQuery>
</EntitySet>
<EntitySet Name="Hotels" EntityType="Self.Hotels" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[Hotels].[Id] AS [Id],
[Hotels].[Name] AS [Name],
[Hotels].[Desc] AS [Desc],
[Hotels].[GroupId] AS [GroupId],
[Hotels].[Code] AS [Code],
[Hotels].[Status] AS [Status],
[Hotels].[IsApprove] AS [IsApprove],
[Hotels].[CreateTime] AS [CreateTime]
FROM [dbo].[Hotels] AS [Hotels]</DefiningQuery>
</EntitySet>
<EntitySet Name="OrgUsers" EntityType="Self.OrgUsers" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[OrgUsers].[UserId] AS [UserId],
[OrgUsers].[Id] AS [Id],
[OrgUsers].[OrgId] AS [OrgId],
[OrgUsers].[CreateTime] AS [CreateTime],
[OrgUsers].[CreatedBy] AS [CreatedBy]
FROM [dbo].[OrgUsers] AS [OrgUsers]</DefiningQuery>
</EntitySet>
<EntitySet Name="TBL_Multilingual" EntityType="Self.TBL_Multilingual" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_Multilingual].[ID] AS [ID],
[TBL_Multilingual].[Language] AS [Language],
[TBL_Multilingual].[ApplicationID] AS [ApplicationID],
[TBL_Multilingual].[Version] AS [Version]
FROM [dbo].[TBL_Multilingual] AS [TBL_Multilingual]</DefiningQuery>
</EntitySet>
<EntitySet Name="TBL_MultilingualApps" EntityType="Self.TBL_MultilingualApps" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_MultilingualApps].[ID] AS [ID],
[TBL_MultilingualApps].[Application] AS [Application],
[TBL_MultilingualApps].[Remark] AS [Remark]
FROM [dbo].[TBL_MultilingualApps] AS [TBL_MultilingualApps]</DefiningQuery>
</EntitySet>
<EntitySet Name="TBL_MultilingualData" EntityType="Self.TBL_MultilingualData" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_MultilingualData].[ID] AS [ID],
[TBL_MultilingualData].[Chinese] AS [Chinese],
[TBL_MultilingualData].[English] AS [English],
[TBL_MultilingualData].[ApplicationID] AS [ApplicationID]
FROM [dbo].[TBL_MultilingualData] AS [TBL_MultilingualData]</DefiningQuery>
</EntitySet>
<EntitySet Name="TBL_RCU_InfraredPacket" EntityType="Self.TBL_RCU_InfraredPacket" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[TBL_RCU_InfraredPacket].[ID] AS [ID],
[TBL_RCU_InfraredPacket].[Type] AS [Type],
[TBL_RCU_InfraredPacket].[Brand] AS [Brand],
[TBL_RCU_InfraredPacket].[Model] AS [Model],
[TBL_RCU_InfraredPacket].[Version] AS [Version],
[TBL_RCU_InfraredPacket].[CreateDate] AS [CreateDate],
[TBL_RCU_InfraredPacket].[PacketName] AS [PacketName],
[TBL_RCU_InfraredPacket].[PacketData] AS [PacketData],
[TBL_RCU_InfraredPacket].[PacketMD5] AS [PacketMD5],
[TBL_RCU_InfraredPacket].[Remark] AS [Remark],
[TBL_RCU_InfraredPacket].[OldPacket] AS [OldPacket]
FROM [dbo].[TBL_RCU_InfraredPacket] AS [TBL_RCU_InfraredPacket]</DefiningQuery>
</EntitySet>
<EntitySet Name="UserAuthoes" EntityType="Self.UserAuthoes" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[UserAuthoes].[UserId] AS [UserId],
[UserAuthoes].[AuthorityId] AS [AuthorityId],
[UserAuthoes].[HotelId] AS [HotelId],
[UserAuthoes].[Id] AS [Id],
[UserAuthoes].[AuthotypeId] AS [AuthotypeId],
[UserAuthoes].[CreateTime] AS [CreateTime],
[UserAuthoes].[CreatedBy] AS [CreatedBy]
FROM [dbo].[UserAuthoes] AS [UserAuthoes]</DefiningQuery>
</EntitySet>
<EntitySet Name="UserInfo" EntityType="Self.UserInfo" store:Type="Tables" store:Schema="dbo">
<DefiningQuery>SELECT
[UserInfo].[Id] AS [Id],
[UserInfo].[Uid] AS [Uid],
[UserInfo].[Pwd] AS [Pwd],
[UserInfo].[PwdSee] AS [PwdSee],
[UserInfo].[HeadImg] AS [HeadImg],
[UserInfo].[Sex] AS [Sex],
[UserInfo].[Age] AS [Age],
[UserInfo].[IsValid] AS [IsValid],
[UserInfo].[Desc] AS [Desc],
[UserInfo].[CreateTime] AS [CreateTime],
[UserInfo].[CreatedBy] AS [CreatedBy],
[UserInfo].[HotelID] AS [HotelID],
[UserInfo].[HotelGroupID] AS [HotelGroupID],
[UserInfo].[IsImport] AS [IsImport],
[UserInfo].[Company] AS [Company]
FROM [dbo].[UserInfo] AS [UserInfo]</DefiningQuery>
</EntitySet>
<AssociationSet Name="FK_dbo_OrgUsers_dbo_Organization_OrgId" Association="Self.FK_dbo_OrgUsers_dbo_Organization_OrgId">
<End Role="Organization" EntitySet="Organization" />
<End Role="OrgUsers" EntitySet="OrgUsers" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="hfModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="C__MigrationHistory">
<Key>
<PropertyRef Name="MigrationId" />
</Key>
<Property Name="MigrationId" Type="String" MaxLength="150" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="ContextKey" Type="String" MaxLength="300" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Model" Type="Binary" MaxLength="Max" FixedLength="false" Nullable="false" />
<Property Name="ProductVersion" Type="String" MaxLength="32" FixedLength="false" Unicode="true" Nullable="false" />
</EntityType>
<EntityType Name="DbLog">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Content" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Uid" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="Type" Type="Int32" Nullable="false" />
<Property Name="Ip" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Client" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="location" Type="String" MaxLength="150" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="Organization">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrganizationName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="IsDefault" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="IsValid" Type="Int32" Nullable="false" />
<NavigationProperty Name="OrgUsers" Relationship="Self.FK_dbo_OrgUsers_dbo_Organization_OrgId" FromRole="Organization" ToRole="OrgUsers" />
</EntityType>
<EntityType Name="AppAutho">
<Key>
<PropertyRef Name="AppId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="Id" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="AppId" Type="Int32" Nullable="false" />
<Property Name="AuthorityId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="ApplicationDomain">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="AppName" />
<PropertyRef Name="IsValid" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AppName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="IsValid" Type="Int32" Nullable="false" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="Authority">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="AuthorityName" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AuthorityName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="IsValid" Type="Int32" />
</EntityType>
<EntityType Name="AuthoStatusType">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Name" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="Hosts">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="HotelID" />
<PropertyRef Name="Status" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="HotelID" Type="Int32" Nullable="false" />
<Property Name="RoomNumber" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Status" Type="Int32" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="RoomStatusID" Type="Int32" />
</EntityType>
<EntityType Name="HotelGroups">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="ParentId" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="ParentId" Type="Int32" Nullable="false" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
</EntityType>
<EntityType Name="Hotels">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="GroupId" />
<PropertyRef Name="Status" />
<PropertyRef Name="IsApprove" />
<PropertyRef Name="CreateTime" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="GroupId" Type="Int32" Nullable="false" />
<Property Name="Code" Type="Int32" />
<Property Name="Status" Type="Int32" Nullable="false" />
<Property Name="IsApprove" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Nullable="false" Precision="3" />
</EntityType>
<EntityType Name="OrgUsers">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="Id" />
<PropertyRef Name="OrgId" />
</Key>
<Property Name="UserId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="OrgId" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="DateTime" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<NavigationProperty Name="Organization" Relationship="Self.FK_dbo_OrgUsers_dbo_Organization_OrgId" FromRole="OrgUsers" ToRole="Organization" />
</EntityType>
<EntityType Name="TBL_Multilingual">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Language" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="ApplicationID" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="Version" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="TBL_MultilingualApps">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Application" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="Remark" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="TBL_MultilingualData">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Chinese" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="English" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
<Property Name="ApplicationID" Type="String" MaxLength="254" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="TBL_RCU_InfraredPacket">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Type" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Brand" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Model" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Version" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="CreateDate" Type="DateTime" Precision="3" />
<Property Name="PacketName" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="PacketData" Type="Binary" MaxLength="Max" FixedLength="false" />
<Property Name="PacketMD5" Type="String" MaxLength="254" FixedLength="false" Unicode="false" />
<Property Name="Remark" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="OldPacket" Type="Boolean" />
</EntityType>
<EntityType Name="UserAuthoes">
<Key>
<PropertyRef Name="UserId" />
<PropertyRef Name="AuthorityId" />
<PropertyRef Name="HotelId" />
<PropertyRef Name="Id" />
<PropertyRef Name="AuthotypeId" />
</Key>
<Property Name="UserId" Type="Int32" Nullable="false" />
<Property Name="AuthorityId" Type="Int32" Nullable="false" />
<Property Name="HotelId" Type="Int32" Nullable="false" />
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="AuthotypeId" Type="Int32" Nullable="false" />
<Property Name="CreateTime" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="UserInfo">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Uid" />
<PropertyRef Name="Pwd" />
<PropertyRef Name="HeadImg" />
<PropertyRef Name="Sex" />
<PropertyRef Name="IsImport" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Uid" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Pwd" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="PwdSee" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="HeadImg" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
<Property Name="Sex" Type="Int32" Nullable="false" />
<Property Name="Age" Type="Int32" />
<Property Name="IsValid" Type="Int32" />
<Property Name="Desc" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="CreateTime" Type="DateTime" Precision="3" />
<Property Name="CreatedBy" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="HotelID" Type="Int32" />
<Property Name="HotelGroupID" Type="Int32" />
<Property Name="IsImport" Type="Int32" Nullable="false" />
<Property Name="Company" Type="Int32" />
</EntityType>
<Association Name="FK_dbo_OrgUsers_dbo_Organization_OrgId">
<End Role="Organization" Type="Self.Organization" Multiplicity="1" />
<End Role="OrgUsers" Type="Self.OrgUsers" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Organization">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="OrgUsers">
<PropertyRef Name="OrgId" />
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="hfEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="C__MigrationHistory" EntityType="Self.C__MigrationHistory" />
<EntitySet Name="DbLog" EntityType="Self.DbLog" />
<EntitySet Name="Organization" EntityType="Self.Organization" />
<EntitySet Name="AppAutho" EntityType="Self.AppAutho" />
<EntitySet Name="ApplicationDomain" EntityType="Self.ApplicationDomain" />
<EntitySet Name="Authority" EntityType="Self.Authority" />
<EntitySet Name="AuthoStatusType" EntityType="Self.AuthoStatusType" />
<EntitySet Name="Hosts" EntityType="Self.Hosts" />
<EntitySet Name="HotelGroups" EntityType="Self.HotelGroups" />
<EntitySet Name="Hotels" EntityType="Self.Hotels" />
<EntitySet Name="OrgUsers" EntityType="Self.OrgUsers" />
<EntitySet Name="TBL_Multilingual" EntityType="Self.TBL_Multilingual" />
<EntitySet Name="TBL_MultilingualApps" EntityType="Self.TBL_MultilingualApps" />
<EntitySet Name="TBL_MultilingualData" EntityType="Self.TBL_MultilingualData" />
<EntitySet Name="TBL_RCU_InfraredPacket" EntityType="Self.TBL_RCU_InfraredPacket" />
<EntitySet Name="UserAuthoes" EntityType="Self.UserAuthoes" />
<EntitySet Name="UserInfo" EntityType="Self.UserInfo" />
<AssociationSet Name="FK_dbo_OrgUsers_dbo_Organization_OrgId" Association="Self.FK_dbo_OrgUsers_dbo_Organization_OrgId">
<End Role="Organization" EntitySet="Organization" />
<End Role="OrgUsers" EntitySet="OrgUsers" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="hfModelStoreContainer" CdmEntityContainer="hfEntities">
<EntitySetMapping Name="C__MigrationHistory">
<EntityTypeMapping TypeName="hfModel.C__MigrationHistory">
<MappingFragment StoreEntitySet="__MigrationHistory">
<ScalarProperty Name="MigrationId" ColumnName="MigrationId" />
<ScalarProperty Name="ContextKey" ColumnName="ContextKey" />
<ScalarProperty Name="Model" ColumnName="Model" />
<ScalarProperty Name="ProductVersion" ColumnName="ProductVersion" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="DbLog">
<EntityTypeMapping TypeName="hfModel.DbLog">
<MappingFragment StoreEntitySet="DbLog">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Content" ColumnName="Content" />
<ScalarProperty Name="Uid" ColumnName="Uid" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="Type" ColumnName="Type" />
<ScalarProperty Name="Ip" ColumnName="Ip" />
<ScalarProperty Name="Client" ColumnName="Client" />
<ScalarProperty Name="location" ColumnName="location" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Organization">
<EntityTypeMapping TypeName="hfModel.Organization">
<MappingFragment StoreEntitySet="Organization">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="OrganizationName" ColumnName="OrganizationName" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="IsDefault" ColumnName="IsDefault" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="AppAutho">
<EntityTypeMapping TypeName="hfModel.AppAutho">
<MappingFragment StoreEntitySet="AppAutho">
<ScalarProperty Name="AppId" ColumnName="AppId" />
<ScalarProperty Name="AuthorityId" ColumnName="AuthorityId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="ApplicationDomain">
<EntityTypeMapping TypeName="hfModel.ApplicationDomain">
<MappingFragment StoreEntitySet="ApplicationDomain">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AppName" ColumnName="AppName" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Authority">
<EntityTypeMapping TypeName="hfModel.Authority">
<MappingFragment StoreEntitySet="Authority">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AuthorityName" ColumnName="AuthorityName" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="AuthoStatusType">
<EntityTypeMapping TypeName="hfModel.AuthoStatusType">
<MappingFragment StoreEntitySet="AuthoStatusType">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Hosts">
<EntityTypeMapping TypeName="hfModel.Hosts">
<MappingFragment StoreEntitySet="Hosts">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="HotelID" ColumnName="HotelID" />
<ScalarProperty Name="RoomNumber" ColumnName="RoomNumber" />
<ScalarProperty Name="Status" ColumnName="Status" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="RoomStatusID" ColumnName="RoomStatusID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="HotelGroups">
<EntityTypeMapping TypeName="hfModel.HotelGroups">
<MappingFragment StoreEntitySet="HotelGroups">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="ParentId" ColumnName="ParentId" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Hotels">
<EntityTypeMapping TypeName="hfModel.Hotels">
<MappingFragment StoreEntitySet="Hotels">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="GroupId" ColumnName="GroupId" />
<ScalarProperty Name="Code" ColumnName="Code" />
<ScalarProperty Name="Status" ColumnName="Status" />
<ScalarProperty Name="IsApprove" ColumnName="IsApprove" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="OrgUsers">
<EntityTypeMapping TypeName="hfModel.OrgUsers">
<MappingFragment StoreEntitySet="OrgUsers">
<ScalarProperty Name="UserId" ColumnName="UserId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="OrgId" ColumnName="OrgId" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_Multilingual">
<EntityTypeMapping TypeName="hfModel.TBL_Multilingual">
<MappingFragment StoreEntitySet="TBL_Multilingual">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Language" ColumnName="Language" />
<ScalarProperty Name="ApplicationID" ColumnName="ApplicationID" />
<ScalarProperty Name="Version" ColumnName="Version" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_MultilingualApps">
<EntityTypeMapping TypeName="hfModel.TBL_MultilingualApps">
<MappingFragment StoreEntitySet="TBL_MultilingualApps">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Application" ColumnName="Application" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_MultilingualData">
<EntityTypeMapping TypeName="hfModel.TBL_MultilingualData">
<MappingFragment StoreEntitySet="TBL_MultilingualData">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Chinese" ColumnName="Chinese" />
<ScalarProperty Name="English" ColumnName="English" />
<ScalarProperty Name="ApplicationID" ColumnName="ApplicationID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TBL_RCU_InfraredPacket">
<EntityTypeMapping TypeName="hfModel.TBL_RCU_InfraredPacket">
<MappingFragment StoreEntitySet="TBL_RCU_InfraredPacket">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Type" ColumnName="Type" />
<ScalarProperty Name="Brand" ColumnName="Brand" />
<ScalarProperty Name="Model" ColumnName="Model" />
<ScalarProperty Name="Version" ColumnName="Version" />
<ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
<ScalarProperty Name="PacketName" ColumnName="PacketName" />
<ScalarProperty Name="PacketData" ColumnName="PacketData" />
<ScalarProperty Name="PacketMD5" ColumnName="PacketMD5" />
<ScalarProperty Name="Remark" ColumnName="Remark" />
<ScalarProperty Name="OldPacket" ColumnName="OldPacket" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserAuthoes">
<EntityTypeMapping TypeName="hfModel.UserAuthoes">
<MappingFragment StoreEntitySet="UserAuthoes">
<ScalarProperty Name="UserId" ColumnName="UserId" />
<ScalarProperty Name="AuthorityId" ColumnName="AuthorityId" />
<ScalarProperty Name="HotelId" ColumnName="HotelId" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="AuthotypeId" ColumnName="AuthotypeId" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserInfo">
<EntityTypeMapping TypeName="hfModel.UserInfo">
<MappingFragment StoreEntitySet="UserInfo">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Uid" ColumnName="Uid" />
<ScalarProperty Name="Pwd" ColumnName="Pwd" />
<ScalarProperty Name="PwdSee" ColumnName="PwdSee" />
<ScalarProperty Name="HeadImg" ColumnName="HeadImg" />
<ScalarProperty Name="Sex" ColumnName="Sex" />
<ScalarProperty Name="Age" ColumnName="Age" />
<ScalarProperty Name="IsValid" ColumnName="IsValid" />
<ScalarProperty Name="Desc" ColumnName="Desc" />
<ScalarProperty Name="CreateTime" ColumnName="CreateTime" />
<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
<ScalarProperty Name="HotelID" ColumnName="HotelID" />
<ScalarProperty Name="HotelGroupID" ColumnName="HotelGroupID" />
<ScalarProperty Name="IsImport" ColumnName="IsImport" />
<ScalarProperty Name="Company" ColumnName="Company" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="无" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="e89ae4af659340afbcfd2d91968d0310" Name="Diagram1">
<EntityTypeShape EntityType="hfModel.C__MigrationHistory" Width="1.5" PointX="0.75" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.DbLog" Width="1.5" PointX="2.75" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.Organization" Width="1.5" PointX="0.75" PointY="1" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.AppAutho" Width="1.5" PointX="4.75" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.ApplicationDomain" Width="1.5" PointX="5.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.Authority" Width="1.5" PointX="6.75" PointY="3.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.AuthoStatusType" Width="1.5" PointX="6.75" PointY="6.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.Hosts" Width="1.5" PointX="8.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.HotelGroups" Width="1.5" PointX="0.75" PointY="8.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.Hotels" Width="1.5" PointX="2.75" PointY="8.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.OrgUsers" Width="1.5" PointX="3" PointY="1.125" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.TBL_Multilingual" Width="1.5" PointX="8.75" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.TBL_MultilingualApps" Width="1.5" PointX="8.75" PointY="7.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.TBL_MultilingualData" Width="1.5" PointX="4.75" PointY="9.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.TBL_RCU_InfraredPacket" Width="1.5" PointX="10.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.UserAuthoes" Width="1.5" PointX="10.75" PointY="4.75" IsExpanded="true" />
<EntityTypeShape EntityType="hfModel.UserInfo" Width="1.5" PointX="6.75" PointY="10.75" IsExpanded="true" />
<AssociationConnector Association="hfModel.FK_dbo_OrgUsers_dbo_Organization_OrgId" ManuallyRouted="false" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"SumInfoModel.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_Customer
{
public int CompanyID { get; set; }
public string CustomerAbbr { get; set; }
public string CustomerName { get; set; }
public System.DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_FlowCtr
{
public int ID { get; set; }
public Nullable<int> ProjectID { get; set; }
public string SUT_SN { get; set; }
public string ProcessRecord { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_Log
{
public int ID { get; set; }
public Nullable<int> UserID { get; set; }
public Nullable<System.DateTime> DateTime { get; set; }
public string Operation { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_Multilingual
{
public int ID { get; set; }
public string Language { get; set; }
public string ApplicationID { get; set; }
public Nullable<int> Version { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_MultilingualApps
{
public int ID { get; set; }
public string Application { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_MultilingualData
{
public int ID { get; set; }
public string { get; set; }
public string English { get; set; }
public string ApplicationID { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_OrderInternal
{
public int ID { get; set; }
public int OrderID { get; set; }
public string InternalNo { get; set; }
public System.DateTime CreateTime { get; set; }
public int ObjectiveYield { get; set; }
public int ObjectiveYieldTotal { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_Orders
{
public int OrderID { get; set; }
public int CompanyID { get; set; }
public int ProductID { get; set; }
public string OrderNo { get; set; }
public int OrderCount { get; set; }
public System.DateTime DeliveryTime { get; set; }
public System.DateTime CreateTime { get; set; }
public float CostPrice { get; set; }
public float TransactPrice { get; set; }
public int OrderStatus { get; set; }
public string Sn_Start { get; set; }
public string Sn_End { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_ProductionLine
{
public int ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码已从模板生成。
//
// 手动更改此文件可能导致应用程序出现意外的行为。
// 如果重新生成代码,将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Face.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class TBL_ProductionPlan
{
public int ID { get; set; }
public int OrderID { get; set; }
public int ProductionLineID { get; set; }
public System.DateTime ProductionTime { get; set; }
public int ActualOutput { get; set; }
public int ObjectiveYield { get; set; }
public string Remark { get; set; }
public string Sn_Start { get; set; }
public string Sn_End { get; set; }
public int OrderInternalID { get; set; }
public int ObjectiveYieldTotal { get; set; }
public int StationID { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More