Querying like Linq when you don't have Linq - database

I have a project that I'm currently working on but it currently only supports the .net framework 2.0. I love linq, but because of the framework version I can't use it. What I want isn't so much the ORM side of things, but the "queryability" (is that even a word?) of Linq.
So far the closest is llblgen but if there was something even lighter weight that could just do the querying for me that would be even better.
I've also looked at NHibernate which looks like it could go close to doing what I want, but it has a pretty steep learning curve and the mapping files don't get me overly excited.
If anyone is aware of something that will give me a similar query interface to Linq (or even better, how to get Linq to work on the .net 2.0 framework) I'd really like to hear about it.

Have a look at this:
http://www.albahari.com/nutshell/linqbridge.html
Linq is several different things, and I'm not 100% sure which bits you want, but the above might be useful in some way. If you don't already have a book on Linq (I guess you don't), then I found "Linq In Action" to be be good.

You might want to check out Subsonic. It is an ORM that uses an ActiveRecord pattern. I'm pretty sure most of its features work with the .NET Framework 2.0.

To echo what Lance said - the SubSonic query language has a fluent interface which isn't as pretty as LINQ, but gives you some of the benefits (compile time checking, intellisense, etc.).

LinqBridge works fine under .NET 2.0, and you get all the Linq extensions and query language. You need VS 2008 in order to use it, but you already knew that.
However, Linq it not an ORM. It's a query syntax. If you want to use Linq to query a database, you will need .NET 3.5. That's because 2.0 does not provide the mechanism needed to convert Linq code to your favorite database query language.
In other words, if an ORM is what you need, LinqBridge will not help you. You need to check out some of the other suggestions provided.

There's a way to reference LINQ in the .NET 2.0 Framework, but I have to warn you that it might be against the terms of use/EULA of the framework:
LINQ on the .NET 2.0 Runtime

First of all. Getting linq itself to work on 2.0 is out of the question. Its possible, but really not something to do outside a testing environment.
The closest you can get in terms of the ORM/Dynamic Querying part of it, is imho SubSonic, which I'll recommend for anyone stuck in C# 2.0

LinqBridge looks like a pretty nice place to start since I have VS2008, I just need to compile and deploy to a .net 2.0 server.
I've looked at SubSonic and it's also an interesting alternative, but linqbridge seems to provide a much closer fit so I'm not going to have to go and learn a new ORM / query syntax.

Related

Data Access in ASP.NET MVC 3

What's the recommended way of creating a Data Access layer in real-life ASP.NET MVC applications? Is it EF? Ef Code First? NHibernate? Any other idea?
Thank you & regards
There is no recommend way.
I prefer EF Code First for doing this because
the Sourcecode is very clean and easy to read
It is easy to simple change the connectionstring and generate a new database if not already exists
easy to migrate your Database if your Model has changed (no need to recreate the Database) using EntityFramework.SqlMigrations
if your Database already exists you can use the Entity Framework Power Tools to generate the Models and Database context from your existing Database
It all depends of your need:
NHibernate is a more mature ORM with a big community
Entity Framework is now getting very well supported and you can find also great information (check Julie Lerman blog)
Both support code generation from database.
Code first: allows you to create your database schema from your domain models. This is great if you don't want to bother with database. NHibernate can do it also.
To help you decide which way to use Entity Framework
Source
There are many other great ORM:
Subsonic
Stackoverflow's ORM Dapper if performance is an important criteria there is a small benchmark on the site
If you're partial to the MSFT tooling and wanting to be "modern", then EF Code First is probably the place to start. One example worth perusing: https://github.com/NuGet/NuGetGallery .
I like to use Model First because it allows me the most freedom to design and implement in my opinion. It also makes it very easy to change the database design.
There is none, stackoverflow is full of people who have gone down the various routes, so you can get help no matter which choice you make.
Best advice, try doing a few small exploratory webs using a couple of approaches which seem to stand out.
The MVC gurus (the people who wrote MVC) at MS all seem to use Entity Framework at the moment. having said that you can use any ORM (or really any data access tech you want) as MVC doesnt actually specify anything at all about the way you access data
Try LINQ, most MVC products I see make use of LINQ.

What is the best scala-like persistence framework available right now?

What is the best scala-like persistence framework available right now?
Hibernate works, but it's not very scala-like. It insists on using annotations, no-arg constructors, doesn't work with anonymous class instances, doesn't work with scala collections, has an outdated string-based query model, etc.
I'm looking for something that really fits Scala. Does it exist? Or do I have to make it?
Squeryl is a strongly typed, LINQ like persistence framework written entirely in Scala.
In any case, it looks very promising. There's also ScalaQuery by Stephan Zeiger, which has a similar approach.
I haven't tried these two out yet, but will likely do so in the very near future.
Old question and that's probably why no one mentioned Slick at the time, but that's a good choice nowadays. It's developed by Typesafe, so there's some assurance of quality and continuous development that other frameworks might not have.
Anyway, this link might be a good source for anyone looking for other options: http://manuel.bernhardt.io/2014/02/04/a-quick-tour-of-relational-database-access-with-scala/.
Lift has a persistence framework in scala, but it's integrated with the web framework and is a bit specialized.
I've not gotten a chance to evaluate it personally, but it looks like eBean is very Scala friendly. It even supports Scala types (as of Release 2.6.1).

Picking an ORM tool - So many choices, and so little time

After much reading, playing and fiddling, I am still not sure what ORM tool is the one i should be using above others.I am usign the Dotnet stack.
I have looked at:
Entity framework
LLBLgen Pro
NHibernate
Currenlty I am rather impressed with LLBLGen Pro.
I have also read about Castle's active record, sub sonic and Linq to SQL.
Why should i use one over the other and what are the pitfalls of using this one over that one?
How should i try and make the informed desicion.
I am concerened about some large gotcha that i might not see at this stage that will only come to life far into the development cycle and then have cause major hassles.
Thanks for all the help.
I have used both NHibernate and Entity Framework and both are great. If you like a more drag-and-drop approach, entity framework is the best choice and maybe the easiest to get started with. If you need a ORM for a commercial product maybe it's easier to sell EF (because Microsoft is behind it). At least that is my experience. But, I'm using HNibernate at my current project (at a customer) and we are very pleased with it. It has a bit of a learning curve, but once you get the hang of it it's pretty productive to use. The only drawback is the XML hacking you have to do. If you have the possibility to use EF 4 I think that would be my recommendation. If not, go for NHibernate.

Any Rails-Migration-like framework suggestions for .NET?

The idea of "rails migration" is awesome and I'm going to use this way in my coming new project on .NET platform for db schema version control.
MigratorDotNet seems like something I need but some limitations block me, such as no stored procedure support. Are there any better solutions for that?
There's a similar question, which incidentally shows up as one of the top google results (wooo, gogo stackoverflow!) with a nice roundup in the top scoring post:
https://stackoverflow.com/questions/313/net-migrations-engine

Creating web forms from a database schema

I'm wondering if there are any applications, preferably freeware, that can take a database configuration, and, with as little hassle as possible, create web forms for inserting data easily.
I'm finding it hard to express exactly what it is I'm after. Maybe I can talk a bit about what I need.
I have a configuration database that, at least usually, contains "the truth" about the servers in our system. It contains stuff like zone names, hostnames, different configuration items, etc, over multiple tables. Right now we're using simple INSERTs directly when adding new servers or other stuff, handling the keys and IDs ourselves. The crux is, they don't want us to develop a simple web form thingy to handle this, instead they want a tool that can generate the web form thingy. Did that make sense?
I'm not sure if anything like this exists or is reliable, but, I thought that if anyone knew, it's this community. Thanks!
As many have already stated, it depends on what technology you're working with:
.Net 3.5 - Dynamic Data or Subsonic's Scaffolding control
.Net 2.0 - Subsonic's Scaffolding control
PHP - CakePHP
Ruby - Rail's Scaffolding component
"with as little hassle as possible"
have you checked things like PHP/MySQL Web Database Application Code Generator 10.02 ?
or phpmyedit ?
seems to me that what everybody else proposed so far requires a fair amount of coding...
Also, have a look at phprunner. It is not free, but looking at the screenshots, it seems to fit your requirements.
ASP.NET has Dynamic Data, that I think fits your description.
There's also SubSonic. Both are free and open source.
Tried Dynamic Data?
Besides ASP.NET dynamic data, you could also have a look at SubSonic
With PHP, if you have the ability to name the tables and columns as you see fit, you could try CakePHP framework, and specifically the scaffolding feature. With scaffolding turned on, the code will create CRUD forms from the schema for you.
Here's the link for learning about SubSonic & Scaffolding http://www.subsonicproject.com/web-forms-controls/the-scaffold/
, enjoy ;)
One more link from the SubSonic forums http://monk.thelonio.us/post/Scaffold-Enhancements-in-SubSonic-21.aspx
You can try Adminer Editor
Adminer Editor is both easy-to-use and user-friendly database editing tool written in PHP. It is suitable for common users, as it provides high-level data manipulation.

Resources