随笔分类 -  ORM

castle ActiveRecord入门实例(2)-映射管理
摘要:1.类别映射[ActiveRecord("Catalog")]public class Catalog: ActiveRecordBase{ [PrimaryKey] public int CatalogId { get; set; } [Property] public string Name { get; set; } [HasMany] public IList MovieList{ get; set; }}[ActiveRecord("Movies")]public class Movies : ActiveRecordBase{ [Primar 阅读全文

posted @ 2012-01-20 09:55 kenny jiang 阅读(144) 评论(0) 推荐(0)

castle ActiveRecord入门实例(1)-单表操作
摘要:1.下载软件http://www.castleproject.org/activerecord/gettingstarted/index.htmlhttp://www.castleproject.org/castle/download.html2.配置文件appconfig.xml 3.Global.asaxvoid Application_Start(object sender, EventArgs e) { XmlConfigurationSource source = new XmlConfigurationSource(Server.MapPath("~/appconfi.. 阅读全文

posted @ 2012-01-19 15:34 kenny jiang 阅读(280) 评论(0) 推荐(0)

Nhiberntae实例(操作Oracle)
摘要:1.文件路径\App_Data\Entity\DEP.cs\App_Data\Entity\NHibernateHelper.cs(参考官方文档)\App_Data\Mapping\DEP.hbm.xml\bin\hibernate.cfg.xml2.hibernate.cfg.xml文件 NHibernate.Driver.OracleClientDriver User ID=kenny1;Password=123456;Data Source=orcl false NHibernate.Dialect.Oracle10gDialect true 1, false 0,... 阅读全文

posted @ 2012-01-01 22:22 kenny jiang 阅读(235) 评论(0) 推荐(0)

LINQ链接数据库出错(There is already an open DataReader associated with this Command which must be closed first )
摘要:LINQ: There is already an open DataReader associated with this Command which must be closed first 在Linq to SQL和Entity Framework,使用Linq查询数据的时候会出现错误:There is already an open DataReader associated with this Command which must be closed first 。解决方案:在数据库连接串上添加MultipleActiveResultSets=true。 阅读全文

posted @ 2011-12-31 15:43 kenny jiang 阅读(281) 评论(0) 推荐(0)

Nibatis实例(2)
摘要:1.配置文件Employee.xml delete from Employee WHERE ID = #Id# insert into Employee (EMPLOYEE_NUMBER, FIRST_NAME,LAST_NAME,TITLE) values (?,?,?,?) update Employee set EMPLOYEE_NUMBER = #EmployeeNumber#,FIRST_NAME = #FirstName#, LAST_NAME = #LastName#,TITLE = #Title# w... 阅读全文

posted @ 2011-12-25 16:21 kenny jiang 阅读(335) 评论(0) 推荐(0)

Nibatis实例(1)
摘要:参考资料 http://www.cnblogs.com/anderslly/archive/2007/09/07/ibatisinactionpreface.html1.实体类using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace NIbatis.Entity{ public class Employee { #region private fields private int id; private int employeeNumber; private string 阅读全文

posted @ 2011-12-24 22:05 kenny jiang 阅读(358) 评论(0) 推荐(0)

Linq入门实例
摘要:1.数据定义using System;using System.Collections.Generic;using System.Web;using System.Linq;using System.Data.Linq;using System.Data.Linq.Mapping;namespace QuickStart{ [Table] public class Cat { private int catId; private string name; private char sex; private float weight; public Cat() { } [Column(IsDb. 阅读全文

posted @ 2011-12-24 16:02 kenny jiang 阅读(258) 评论(0) 推荐(0)

Entity Framework实例
摘要:1、数据定义Book表using System;using System.Data.Objects;using System.Data.Objects.DataClasses;using System.Data.EntityClient;using System.ComponentModel;using System.Data.Entity;using System.ComponentModel.DataAnnotations;namespace EFTest.Models.Part2{ [Table("Book")] public class Book { [Key] p 阅读全文

posted @ 2011-12-24 15:48 kenny jiang 阅读(754) 评论(0) 推荐(0)