从数据库生成POCO / DTO的工具(SQL Server)

时间:2011-01-29 10:37:21

标签: c# .net sql-server database

哪些免费工具可以从MS SQL Server数据库生成简单的POCO / DTO类?使用属性和字段,但不再是

2 个答案:

答案 0 :(得分:9)

查看MyGeneration - 它是SQL Server的免费代码生成工具,可让您定义将由数据库结构驱动的模板。

决定另一方会发生什么。

答案 1 :(得分:8)

找不到合适的,因此创建了一个非常简单的TSQL脚本。这是gist

示例输出:

public class EmployeeDto
{
        public int Id { get; set; }
        public int AccountId { get; set; }
        public string ExternalId { get; set; }
        public string EmailAddress { get; set; }
        public bool IsActive { get; set; }
        public string UniqueId { get; set; }
        public bool IsBuiltIn { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string MiddleName { get; set; }
        public bool IsAuthorizedOnAllDepartments { get; set; }
}