RSS 2.0 Feed
Database
摘要:.Net Beta2中消失的ObjectSpaces正式成为了过去,而DLinq从ObjectSpaces的灰烬出生了。DLinq是在分析了ObjectSpaces的反馈之后重新设计的ORM Solutions。 DLinq:.NET Language Integrated Query for Relational Data,DLinq和XLinq(for Xml)共同组成了.net 3.0的关键部分——LinQ(:.NET Language Integrated Query ),即语言级集成查询能力。 DLinq是在分析了ObjectSpaces的反馈之后重新设计的ORM Solutions,作为更先进的查询数据库得到对象并且持久化对象的方式,DLinq将不再使用ObjectSpaces的mapping文件方式,而是使用了attribute 来进行mapping的定义。当然现在也有一些采用attribute 方式的Solutions,如XPO:http://www.devexpress.com/Products/NET/XPO/。不过DLinq的第一大特点将是任何ORM方案难以匹敌的,那就是语言级别的查询集成。这是目前ORM阵营(无论是.net、java或者其他)中都难以做到的。毕竟Linq是Anders Hejlsberg在主导(猜测,因为Demo和Channel9 video都是他),而这也是.net 3.0的主要提升啊。 此文依据 Dinesh Kulkarni(Program Manager Visual C#,working on C# 3.0) http://blogs.msdn.com/dinesh.kulkarni/archive/2005/09/13/465089.aspx...[阅读全文]

posted @ | Feedback (6) | Filed Under [ DOTNET Database ]

摘要:1.实体类: [Table(Name="Customers")]public class Customer{public string CustomerID; public string City;} 使用Attribute定义ORM的关系,这样的好处是无需产生和维护大量映射文件。 [Table(Name="Customers")]public class Customer{[Column(Id=true)]public string CustomerID; [Column]public string City;} 通过Attribute自定义列,定义主键(PK)……    2.数据上下文          // DataContext takes a connection string DataContext db = new  DataContext("c:\\northwind\\northwnd.mdf"); // Get a typed table to run queriesTable<Customer> Customers = db.GetTable<Customer>(); // Query for customers from Londonvar q =from c in Customerswhere c.City == "London"select c; foreach (var cust in q)Console.WriteLine("id = {0}, City = {1}", cust.CustomerID, cust.City);             这个比较猛,直接写查询,from in where select都成了关键字。直接在对象上进行查询不再考虑数据库了。并且范型化了。             看到var,众位做过asp的兄弟是不是很亲切阿,这是动态语言(解释语言)的特性,变量定义时不定义类型,不过这里应该不是动态语言,应该是根据上下文在编译时确定类型的。   Northwind db = new Northwind("c:\\northwind\\northwnd.mdf"); var q =from c in db.Customerswhere c.City == "London"select c;          foreach (var cust in q)         Console.WriteLine("id = {0}, City = {1}",cust.CustomerID, cust.City);          简单写法。   public partial class Northwind : DataContext{   public Table<Customer> Customers;   public Table<Order> Orders;    public Northwind(string connection): base(connection) {}} 继承一下,表成了成员了。  3.关系定义   [Table(Name="Customers")]public class......[阅读全文]

posted @ | Feedback (17) | Filed Under [ DOTNET Database ]

摘要:创建数据库实例问题多多,忙了两天才可以,具体问题出在哪里也不知道。成功的一次:用本地administrator帐号(用属于administrator组的域帐号试了多次多没戏),没有添加示例数据(手工都没有添加上),所有管理帐号密码用的oracle(成功后改掉了)。 创建成功后重新启动用OEM居然连不到,后来用了http://hostname:5500/em 进入,告诉我需要启动数据库,难怪OEM连不上,输入了本地帐号和Oracle帐号启动了数据库后,OEM也能连得上了。 http://hostname:5500/em  的性能监测可以用SVG Viewer,呵呵    ...[阅读全文]

posted @ | Feedback (8) | Filed Under [ Database ]