摘要: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
阅读全文
摘要: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..
阅读全文
摘要: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,...
阅读全文
摘要: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。
阅读全文
摘要: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...
阅读全文
摘要:参考资料 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
阅读全文
摘要: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.
阅读全文
摘要: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
阅读全文