A new Delphi ORM framework has been revealed, now in Beta. I know Devart as the solid data access components provider, maybe their new product will be another good tool for us.

A new Delphi ORM framework has been revealed, now in Beta. I know Devart as the solid data access components provider, maybe their new product will be another good tool for us.
https://plus.google.com/100618524626212041258/posts/bgMXYrHnoSz

Comments

  1. If I got a cent everytime someone misuses the name LINQ for some programming API to create SQL statements I would be rich.

    While EntityDAC looks interesting it certainly is not LINQ if you write DataContext.From(Emp).Where(Emp['Sal'] > 1000).

    P.S. Am I missing something and DevArt improved the Delphi compiler or added their own one?
    From their site:
    "Using LINQ also significantly simplifies writing and further support of queries, since, at this, the Code completion Delphi engine is used when typing LINQ keywords, class names, their attributes, etc. And in the same way, LINQ queries syntax check is performed at the stage of application compilation."
    What LINQ keywords? How can magic strings (like the 'Sal' in the example above which was taken from their documentation that comes with the beta trial) be provided by code completion and syntax checking performed on?

    ReplyDelete
  2. I guess we are talking generated classes from the SQL schemas, which gives code completion while typing in the editor.

    ReplyDelete
  3. Even given the lack of compiler support for query syntax I wouldn't consider something LINQ unless it behaved exactly like the .NET LINQ method syntax API.

    To me one of the main benefits of LINQ is that you can use the same queries against in-memory collections as you can against an SQL data store. Spring4D probably gets close to  LINQ to Objects but it is limited by lack of some of the syntactic sugar. At best it could be called LINQish.

    A true LINQ implementation would have to have a mechanism for adding new LINQ providers. I think this would require some cooperation between ORM/OPF projects and the third party collections projects to really be useful.

    ReplyDelete
  4. Kenneth Cochran Imho LINQ like .Net cannot be done in current Delphi language. As you said LINQ to objects is the easy part. You can read the series from Jon Skeet how to reimplement that (which I did when I refactored the Spring4D classes).

    But LINQ to SQL (which is the interesting thing in this context) is a different story. This is done over the Queryable class in .Net which translates the extension methods calls and their parameters (simple arguments and lambda expressions or delegates) into an expression tree that is then used to build the SQL statement(s). And this is something that is not possible currently.

    The closest you get there is how it is done here where you just abstract the hardcoding of SQL statements into some meta layer. With some tricks like the TExpression record used for simple expressions like "where salary > 1000" it makes the thing more readable but I would hardly call this LINQ.

    I researched the possibilities in Delphi a couple years ago and got to a point that was very similar to what Devart is doing now (generating classes from DB schema and using an expression tree) but usability was not to my satisfaction so I stopped working on that. What I like though is the way to abstract the SQL from the code which is so much more elegant than what I have used at work to dynamically build SQL queries.

    ReplyDelete

Post a Comment