20070704 cross python linq DynamicQueryable
http://www.yippeesoft.com

崩溃的一天~~~~~~~~~

载到了Visual C# “Orcas” Express Edition,因为该版本不支持SQL Server 2005 Developer Edition的链接,所以结合SQL Server Express Edition的AdventureWorks数据库

DynamicQueryable
class Program
    &leftsign;
        static void Main(string[] args)
        &leftsign;
            // For this sample to work, you need an active database server or SqlExpress.
            // Here is a connection to the Data sample project that ships with Orcas.
            string dbPath = Path.GetFullPath(Path.Combine(Application.StartupPath, @"..\\..\\..\\..\\Data\\NORTHWND.MDF"));
            string sqlServerInstance = @".\\SQLEXPRESS";
            string connString = "AttachDBFileName=\’" + dbPath + "\’;Server=\’" + sqlServerInstance + "\’;user instance=true";
           
            // See the ReadMe file for alternate connection strings.
            Northwind db = new Northwind(connString);
            db.Log = Console.Out;

            var query =
                db.Customers.Where("City == @0 and Orders.Count >= @1", "London", 10).
                OrderBy("CompanyName").
                Select("New(CompanyName as Name, Phone)");

            Console.WriteLine(query);
            Console.ReadLine();
        &rightsign;
    &rightsign;

不告诉我怎么取数据

大哥,你不说我怎么知道啊

IEnumerator im= query.GetEnumerator();
            im.MoveNext();
            Console.WriteLine(im.Current.ToString());
  SELECT [t0].[CompanyName], [t0].[Phone]
FROM [Customers] AS [t0]
WHERE ([t0].[City] = @p0) AND (((
    SELECT COUNT(*)
    FROM [Orders] AS [t1]
    WHERE [t1].[CustomerID] = [t0].[CustomerID]
    )) >= @p1)
ORDER BY [t0].[CompanyName]
– @p0: Input NVarChar (Size = 6; Prec = 0; Scale = 0) NOT NULL [London]
– @p1: Input Int (Size = 0; Prec = 0; Scale = 0) NOT NULL [10]
SqlProvider\\AttributedMetaModel

&leftsign;Name=Around the Horn, Phone=(171) 555-7788&rightsign;

我倒是看到了,可是怎么取出来~~~~~~ 郁闷~~

IEnumerator<Customer> im= query.GetEnumerator();
error CS0266: Cannot implicitly convert type \’System.Collections.IEnumerator\’ to \’System.Collections.Generic.IEnumerator<nwind.Customer>\’. An explicit conversion exists (are you missing a cast?)

IEnumerator<Customer> im= (IEnumerator<Customer>)query.GetEnumerator();

System.InvalidCastException: 无法将类型为“ObjectReader`1[DynamicClass1]”的对象强制转换为类型“System.Collections.Generic.IEnumerator`1[nwind.Customer]”。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://mail.python.org/pipermail/python-dev/2003-January/032511.html

Crosscompiling Python

I\’d like to be able to cross-compile Python and its extensions. This page is where I\’m collecting notes on the subject.

I have noticed that there\’s a big gotcha: you have to use the exact same sources for Python for the build system and for the target, because the python scripts used to build python (gawd, that\’s sick) relentlessly refer to the build system\’s copy of the Python library, even if you try to use a different one. Thus any patches to distlib will be almost completely ignored unless they are also patched in the build system Python library. Thus you really do seem to have to build Python once for the build system immediately before building it for the target. Maybe this will change once a version of the cross-compilation patch makes it into the main python tree.

Another huge issue is that you have to keep setup.py and friends from searching /usr and /usr/local for libraries to wrap. Of the patches below, only gentoo\’s seems to do this.

Patches

All of these seem to contribute something new; it would probably be good to combine them all into a best-of-breed crosscompilation patch for Python.

Other

原创文章,转载请注明: 转载自YippeeSoft开心软件

本文链接地址: 20070704 cross python linq DynamicQueryable

历史博文

标签:, ,