随笔分类 -  开源框架

摘要:利用命令行安装包 阅读全文
posted @ 2013-08-10 20:39 Master HaKu 阅读(1258) 评论(0) 推荐(0) 编辑
摘要:我们知道, 对于数据库中的一对多关系, 我们在建表的时候, 应该在多表这里建立外键我们准备这样一个场景, 大学里的系和学生, 一个系有多个学生Department类和Xml如下:Department.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceNHibernate3.Domain{publicclassDepartment{publicvirtualint?ID{get;set;}publicvirtualstringName{get;set;}}}Depar. 阅读全文
posted @ 2012-06-15 17:40 Master HaKu 阅读(1351) 评论(0) 推荐(0) 编辑
摘要:1. 基本映射常用标签 作为NHibernate这个ORM框架来说: 一个实体类对应的是数据库中的一张表; 类中的一个属性对应表中的一个字段; 一个对象对应的是表中的一条记录。 1.1 hibernate-mapping <hibernate-mapping>标签是NHibernate映射文件的根节点。 <hibernate-mapping schema="schemaName" 数据库schema名称。 default-cascade="none|save-update"默认的级联风格,(可选 - 默认为 none):。 auto-i 阅读全文
posted @ 2012-06-15 15:19 Master HaKu 阅读(2651) 评论(0) 推荐(0) 编辑
摘要:1. 建立Domain项目 Product.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceNHibernate3.Domain{publicclassProduct{///<summary>///ID///</summary>publicvirtualGuidID{get;set;}///<summary>///编号///</summary>publicvirtualstringCode{get;set;}///&l 阅读全文
posted @ 2012-06-11 10:10 Master HaKu 阅读(395) 评论(0) 推荐(0) 编辑
摘要:1. 抽象注入接口publicinterfaceIDeviceWriter{voidsaveToDevice();}2. 接口的具体实现 实现1publicclassFloppyWriter:IDeviceWriter{publicvoidsaveToDevice(){Console.WriteLine("储存至软盘…");}} 实现2publicclassUsbDiskWriter:IDeviceWriter{publicvoidsaveToDevice(){Console.WriteLine("储存至移动硬盘…");}}3. 需要注入的业务对象pub 阅读全文
posted @ 2012-05-31 10:24 Master HaKu 阅读(513) 评论(0) 推荐(0) 编辑
摘要:1. 配置文件<configuration><configSections><sectionGroupname="spring"><sectionname="context"type="Spring.Context.Support.ContextHandler,Spring.Core"/><sectionname="objects"type="Spring.Context.Support.DefaultSectionHandler,Spring.Cor 阅读全文
posted @ 2012-05-30 15:39 Master HaKu 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1. Library文件 需要的dll文件如下: FluentNHibernate.dll (*) NHibernate.ByteCode.Castle.dll (*) NHibernate.dll (*) Remotion.Data.Linq.dll Antlr3.Runtime.dll Castle.Core.dll Iesi.Collections.dll2. 创建Hibernate访问通用类usingSystem;usingSystem.Collections.Generic;usingFluentNHibernate.Cfg;usingFluentNHibernate.Cfg.Db; 阅读全文
posted @ 2012-03-12 16:28 Master HaKu 阅读(1988) 评论(0) 推荐(0) 编辑
摘要:概述:当运行session.Save(tnp);时,出现这个"Unknown entity class: TestCleanSnow.TestNhibernatePerson"这个异常. 映射文件 TestNhibernatePerson.hbm.xml如下: <?xmlversion="1.0"encoding="utf-8"?><hibernate-mappingxmlns="urn:nhibernate-mapping-2.2"assembly="TestCleanSnow&quo 阅读全文
posted @ 2011-09-16 14:14 Master HaKu 阅读(1960) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示