I have cooked a hacky dblinq integration to mcs tree. It's almost
just a manual copy of sources from trunk and *.dll.sources hack.
Not an ideal way of doing it, but it was like an hour of hack.
The following URL is a link to the archive of System.Data.Linq
directory that is to put under (mcs_topdir)/class directory:
http://veritas-vos-liberabit.com/tmp/2008/0814/System.Data.Linq.tar.bz2
I also put README there, in case you wonder what to do.
Pablo, if you have some runnable samples, can you cook some
instruction on how to run them so that we can try your effort out?
It would also be important for GSoC evaluators (not memtors, in
this case).
Atsushi Eno
Hello,
I have cooked a hacky dblinq integration to mcs tree. It's almost
just a manual copy of sources from trunk and *.dll.sources hack.
Not an ideal way of doing it, but it was like an hour of hack.
The following URL is a link to the archive of System.Data.Linq
directory that is to put under (mcs_topdir)/class directory:
http://veritas-vos-liberabit.com/tmp/2008/0814/System.Data.Linq.tar.bz2
I also put README there, in case you wonder what to do.
Pablo, if you have some runnable samples, can you cook some
instruction on how to run them so that we can try your effort out?
I made some API fixes to fix build. Some sources in sugar were missing
MONO_STRICT switch, and marked as public:
GroupByExpression.cs
ScopeExpression.cs
Makefile:3: ../../build/rules.make: No such file or directory
Makefile:29: ../../build/library.make: No such file or directory
make: *** No rule to make target `../../build/library.make'. Stop.
gmcs.exe /codepage:65001 -optimize -d:NET_1_1 -d:NET_2_0 -debug /noconfig /r:System.dll /r:System.Core.dll /r:System.Xml.dll /r:System.Data.dll /d:MONO_STRICT -d:NET_3_5 -nowarn:1720 -target:library -out:../../class/lib/net_2_0/System.Data.Linq.dll @System.Data.Linq.dll.sources
DbLinq/Data/Linq/Implementation/MemberModificationHandler.cs(189,61): error CS0246: The type or namespace name `PropertyChangingEventArgs' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings
Pablo Iñigo Blasco wrote:
> I made some API fixes to fix build. Some sources in sugar were missing
>
> MONO_STRICT switch, and marked as public:
> GroupByExpression.cs
> ScopeExpression.cs
>
>
> AFAIK such classes are obsoletes (ie:GroupByExpression has been replaced
> by GroupExpression ), maybe they are oldengine's classes, there are no
> references to them in the whole project. They aren't included in
> DbLinq.csproj too.
OK, just verified that they do not exist in .csproj.
> Regards the build of the tarball, excuse me about my clumsiness:
> I tried to run "make POFILE=net_2_0" and I got:
>
> Makefile:3: ../../build/rules.make: No such file or directory
>
> Makefile:29: ../../build/library.make: No such file or directory
>
> make: *** No rule to make target `../../build/library.make'. Stop.
>
>
> After I tried to do it manually:
>
> gmcs.exe /codepage:65001 -optimize -d:NET_1_1 -d:NET_2_0 -debug
> /noconfig /r:System.dll /r:System.Core.dll /r:System.Xml.dll
> /r:System.Data.dll /d:MONO_STRICT -d:NET_3_5 -nowarn:1720
> -target:library -out:../../class/lib/net_2_0/System.Data.Linq.dll
> @System.Data.Linq.dll.sources
>
> DbLinq/Data/Linq/Implementation/MemberModificationHandler.cs(189,61):
> error CS0246: The type or namespace name `PropertyChangingEventArgs'
> could not be found. Are you missing a using directive or an assembly
> reference?
>
> Compilation failed: 1 error(s), 0 warnings
>
>
>
> So I moved the project to the mcs/class/System.Data.Linq foder and I got
> the System.Data.Linq.dll but executing all the mono build, Is it the
> correct way? (it failed on the signing stage however the assembly was in
> mcs/class/lib/net_2_0)
Yes, that's the only way to build our class libs (move there and
run make PROFILE=*), except for that assembly key problem. We may
need different AssemblyInfo.cs in our tree, apart from the one in
.csproj. It depends on the build tree layout and build platforms.
Atsushi Eno
Pablo, if you have some runnable samples, can you cook some
instruction on how to run them so that we can try your effort out?
It would also be important for GSoC evaluators (not memtors, in
this case).
Console.WriteLine("OS:" + System.Environment.OSVersion + ", Environment.Version:" + System.Environment.Version.Build);
IDbConnection conn = new System.Data.SqlClient.SqlConnection("Data Source=192.168.1.61\\SQLEXPRESS,1154;Integrated Security=False;Initial Catalog=Northwind;User Id=dblinqUser;Password=linq2");
conn.Open();
Console.WriteLine(conn.State);
Northwind nwindDb = new Northwind(conn);
//simple scalar query
Console.WriteLine("Number of Employees:" + nwindDb.Customers.Count());
//filter + orderby
var customers = nwindDb.Customers.Where(e => e.Orders.Any())
.OrderByDescending(c => c.CustomerID)
.ToList();
foreach (var a in customers)
{
Console.WriteLine("Customer '{0}':", a.CustomerID);
//anonymous projections
var customerOrdersInfo = a.Orders.Select(o => new { o, o.ShipAddress });
Console.WriteLine("\tNumber of pending orders:" + a.Orders.Count);
//entitySet access
if (a.Orders.Any())
{
foreach (var orderInfo in customerOrdersInfo)
{
Console.WriteLine("\t·order: {0}", orderInfo.o.OrderID);
if (!string.IsNullOrEmpty(orderInfo.o.ShipAddress))
Console.WriteLine("\tIt should be sent to: {0} {1} {2}", orderInfo.ShipAddress, orderInfo.o.ShipCity, orderInfo.o.ShipCountry);
};
}
Console.WriteLine();
}
//more complex scalar query
bool d = nwindDb.Orders.Any(o => o.Customer.ContactName == "WARTH");
Console.WriteLine();
Console.WriteLine("Are there any order for WARTH? " + (d ? "yes" : "no").ToString());
Console.WriteLine();
//anonymous projection+ filter query + orderby
var q = (from e in nwindDb.Employees
where e.Orders.Any(o => o.Customer.CustomerID == "AIRBU" || o.Customer.CustomerID == "BONAP")
orderby e.FirstName
select new { Name = e.FirstName + "," + e.LastName, e.HomePhone }).ToList();
foreach (var emp in q)
Console.WriteLine(emp.Name + ", Phone:" + emp.HomePhone);
//strings operations
var shortphones = nwindDb.Customers.Where(c => (c.CustomerID.Trim().Contains("T") || c.Country == "France"))
.Select(z => new { z.Phone, Name = z.CustomerID.ToLower() });
foreach (var shortphone in shortphones)
if (shortphone != null)
Console.WriteLine(shortphone.Name + ":" + shortphone.Phone);
Customer newCust = nwindDb.Customers.FirstOrDefault(x => x.CustomerID == "PAUL");
if (newCust != null)
{
//write/delete
Console.WriteLine("customer 'PAUL' already exists, removing...");
nwindDb.Customers.DeleteOnSubmit(newCust);
nwindDb.SubmitChanges();
Console.WriteLine("done");
}
Console.WriteLine("Checking if Paul is in the database");
newCust = nwindDb.Customers.FirstOrDefault(x => x.CustomerID == "PAUL");
if (newCust != null)
Console.WriteLine("Paul is in the database");
else
Console.WriteLine("Paul is not in the database");
//write/insert
Console.WriteLine("Inserting new customer..");
newCust = new Customer { CustomerID = "PAUL", City = "Seville", Country = "Spain" ,CompanyName="Mono"};
nwindDb.Customers.InsertOnSubmit(newCust);
nwindDb.SubmitChanges();
Console.WriteLine("done");
newCust = nwindDb.Customers.FirstOrDefault(x => x.CustomerID == "PAUL");
if (newCust != null)
{
Console.WriteLine("Paul is in the database");
Console.WriteLine("{0} {1} {2}", newCust.CustomerID, newCust.City, newCust.Country);
}
else
Console.WriteLine("Paul is not in the database");