下载地址:http://www.downxia.com/downinfo/26449.html#softdown
使用版本:4.6(2014-5-5)
下载安装,启动
编辑“数据类型映射文件”(可选)(默认映射文件中的数据类型可能会不全,需要根据需要进行补充)
- 打开安装目录下的
DbTypetoCSharpType.xml
文件,找到<POSTGREsql>
部分,编辑需要的数据类型。例如:
<bytea>byte</bytea> <character_x0020_varying>string</character_x0020_varying> <double_x0020_precision>double</double_x0020_precision> <!-- timestamp with time zone --> <timestamp_x0020_with_x0020_time_x0020_zone>DateTime</timestamp_x0020_with_x0020_time_x0020_zone> <uuid>Guid</uuid> <!-- bytea[] --> <bytea_x005B__x005D_>byte[]</bytea_x005B__x005D_> <!-- character(256) --> <character_x0028_256_x0029_>string</character_x0028_256_x0029_>
- 打开安装目录下的
设置“代码命名空间”
代码使用:
打开生成目录下的“相关配置\配置说明4.txt”,其中介绍了生成代码的使用方法
-
字段名称 字段类型 id uuid name character(50) comment character(256) using System; using DAL; namespace BLL { public class TestBLL { // 添加一行记录 public Guid Add(string name,string comment) { Test test = new test(); test.id = Guid.NewGuid(); test.name = name; test.comment = comment; test.Insert(); return test.id; } // 获取所有记录 public TestS GetAll() { return new TestS(true); } // 获取指定id的记录 public Test Get(Guid id) { Test test = new test(); test.id = id; return test.GetEntity(); } // 更新指定id的记录 public void Update(Test test) { test.Update(); } // 删除指定id的记录 public void Delete(Test test) { test.Delete(); } } }
-
TestBLL bll = new TestBLL(); bll.Add("test1",""); //插入记录 Guid id = bll.Add("test2",""); //插入记录 TestS tests = bll.GetAll(); //获取全部记录 Test test = bll.Get(id); //获取指定id的记录 test.comment = "comment2"; bll.Update(test); //更新记录 bll.Delete(test); //删除记录
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。