DbEntry查询表的使用

 

using System;
using Lephone.Data;
using Lephone.Data.Definition;

using Lephone.Web;

namespace Debug
{
    public class TestClass1 : DbObject
    {
        public string Name;
    }

    public class TestClass2 : DbObject
    {
        public int Age;
    }

    [JoinOn(0, "TestClass1.Id", "TestClass2.Id", CompareOpration.Equal, JoinMode.Inner)]
    [CreateTableList(typeof(TestClass1), typeof(TestClass2))]
    public class JoinClass : IDbObject
    {
        public string Name;
        public int Age;
    }

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hellow world!");
            //DbEntry.Context.DropAndCreate(typeof(TestClass1));
            //DbEntry.Context.DropAndCreate(typeof(TestClass2));

            //TestClass1 t1 = new TestClass1();
            //t1.Name = "wxy";
            //DbEntry.Save(t1);

            //TestClass2 t2 = new TestClass2();
            //t2.Age = 1;
            //DbEntry.Save(t2);

            var list = DbEntry.From<JoinClass>().Where(null).Select();
            Console.WriteLine(list.Count);
            Console.ReadLine();
        }
    }
}

 

posted @ 2009-12-08 20:17  shiningrise  阅读(521)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css