Do you have a great idea about Opf3? Let us know and maybe your features will be in the next release!
 | |
| | any planings to implement LINQ in OPF3 ?
|
 | |
| | I have a working prototype here Just need to find somebody to test it out. Anybody willing?
|
 | |
| | I'm willing! I've been playing with it more and more over the last month or so and it rocks.
Al
|
 | |
| | OK! I'll send you an e-mail 
Christian
|
 | |
| | Any news about Linq ?
|
 | |
| | From playing with the test build here is some sample syntax. The best part (for me) is that this was tested against an Oracle DB and Access and still worked.
simple LINQ syntax:
var query = from c in context.GetPersistents<Contact>() orderby c.ContactID select c;
LINQ Against an existing Objectset
ObjectSet<Contact> contacts = query.GetObjectSet(); //noticed how the where clause is based on a based on a related object - so cool! :=D var newquery = from c in contacts where c.ContactType.Type.ToUpper() == "BUYER" orderby c.LastName select c;
Get an Anonymous type against an existing ObjectSet
var anonquery = from c in contacts where c.ContactType.Type.ToUpper() == "BUYER" orderby c.LastName select new { ContactID = c.ContactID , LastName = c.LastName , Firstname = c.FirstName };
joins
var query = from c in context.GetPersistents() join u in context.GetPersistents() on c.ID equals u.ID select u;
To Setup Your context only requires adding a line of code:
ObjectContext context = new ObjectContext(new MsSqlStorage("sa", "password", "localhost\\sqlexpress", "Test")); Specify the command builder to have LinqQueries translated into SQL. context.Storage.StorageCommandBuilders.Add(new LinqQueryCommandBuilder());
There are still some bugs to work out but overall it works great. The ability to execute LINQ against any DB (supported by Opf3 of course) and not just MsSql is huge. Additionally LINQ allows running queries against in memory ObjectSets provides all kinds of ways to enhance local caching for clients.
hth Al
|
 | |
| | Onorio Ribolzi wrote: Any news about Linq ? I'm working on it right now. If you want to test it out, please an e-mail to support :) The e-mail addresses are found here: http://www.opf3.com/Opf3/About/Contact.aspx
|
 | |
| | Any updates or testing that you still need help with?
-Al
|
 | |
| | Hi!
there are no updates so far... I'm still working on it :)
Christian
|
 | |
| | Cool, thanks for the update. Here's a bug for you in case you didn't already have it
string LastNameSearchString = "Smith"; var analystlist = from analysts in context.GetPersistents<Analyst>() where analysts.LastName == LastNameSearchString select analysts;
The exception I get is an "System.ArgumentOutOfRangeException: Length cannot be less than zero". I can send the full details if you want although I'm sure it' easy to reproduce !
I also tried using contains and startswith:
var analystlist = from analysts in context.GetPersistents<OSI.Analyst>() where analysts.LastName.Contains(LastNameSearchString) select analysts;
They don't throw an exception but they generate the following SQL
Select * from Analyst where LastName = and all records are returned!
Al
|
 | |
| | Hey just out of curiosity is the new version going to be based on Linq To Entities?
-Al
|
 | |
| | Hi!
LINQ to entities is a new framework. Opf3 is not going to be based on it because that would really mean a complete rewrite of the framework.
Christian
|
 | |
| | I have created a short blog post to show how to set LINQ to Opf3 up: http://www.liensberger.it/web/blog/?p=235
|
 | |
| | I also have this problem in the 3.0.14.1043 version. If i use a variable in the where clause it doesnt work. Has this already been fixed?
Alfred Ortega wrote:
Cool, thanks for the update. Here's a bug for you in case you didn't already have it string LastNameSearchString = "Smith"; var analystlist = from analysts in context.GetPersistents<Analyst>() where analysts.LastName == LastNameSearchString select analysts;
The exception I get is an "System.ArgumentOutOfRangeException: Length cannot be less than zero". I can send the full details if you want although I'm sure it' easy to reproduce !
I also tried using contains and startswith:
var analystlist = from analysts in context.GetPersistents<OSI.Analyst>() where analysts.LastName.Contains(LastNameSearchString) select analysts;
They don't throw an exception but they generate the following SQL
Select * from Analyst where LastName = and all records are returned!
Al
|
 | |
| | Send me an e-mail over and I will send you an updated version. I'm working on Opf3 right now and I'm going to release the changes in the near future!
|
 | |
| | Hi, I'm also getting a linq exception but its slightly different to the c# errors.
'VB.NET Dim users = From u In context.GetPersistents(Of DAL.ApplicationUser)() Where u.LogonName = "admin" Select u
the error is a sql error "invalid syntax near ="
the generated sql (from users.ToString) is "select [ApplicationUsers].* from [ApplicationUsers] where (( = @p0))"
its like its not picking up the field name in the where clause.
Here is the property from the ApplicationUser class
<Field(FieldName:="LogonName", AllowDBNull:=False)> _ Public Property LogonName() As String Get Return _LogonName End Get Set(ByVal Value As String) _LogonName = Value End Set End Property
Cheers, Joel
|
 | |
| | Could you send me a mail. I have a newer version of the LINQ provider available and could send you that one.
|
 | |
| | So is there a new version coming out then?
|
 | |
| | Sure Al. But you have already that "new" version ;) The joins are still missing.
|
 | |
| | Yes the Joins would be great to have. Any time frame on when it may be coming?
|