Hibernate analog for .NET

S

Sergiu DUDNIC

Hello,

I would like to know, if there are a analog for the Hibernate 's Java
approach in the .NET Framework.

As I understand Java's hibernate allows to conserve, and use the programmed
objects in the SQL relationnal databases's tables.

For .NET, there is somthing similar in LINQ. There is also available a
NHibernate. I am new in this things, can somebody advice me from where to
begin, and in general, maybe .NET has something more powerful to optimise
code's intercation with the database?..


/sergiu
 
M

Michael Nemtsev [MVP]

Hello Sergiu,

ADO Entity Framework. See there http://msdn2.microsoft.com/en-us/library/aa697427(VS.80).aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


SD> Hello,
SD>
SD> I would like to know, if there are a analog for the Hibernate 's
SD> Java approach in the .NET Framework.
SD>
SD> As I understand Java's hibernate allows to conserve, and use the
SD> programmed objects in the SQL relationnal databases's tables.
SD>
SD> For .NET, there is somthing similar in LINQ. There is also available
SD> a NHibernate. I am new in this things, can somebody advice me from
SD> where to begin, and in general, maybe .NET has something more
SD> powerful to optimise code's intercation with the database?..
SD>
SD> /sergiu
SD>
 
A

Arne Vajhøj

Sergiu said:
I would like to know, if there are a analog for the Hibernate 's Java
approach in the .NET Framework.

As I understand Java's hibernate allows to conserve, and use the
programmed objects in the SQL relationnal databases's tables.

For .NET, there is somthing similar in LINQ. There is also available a
NHibernate. I am new in this things, can somebody advice me from where
to begin, and in general, maybe .NET has something more powerful to
optimise code's intercation with the database?..

Two O/R mappers with a good reputation is NHibernate and
LLBLGen.

LINQ is only an option if you are already developing for 3.5.

Arne
 
C

ch

Hello,

I would like to know, if there are a analog for the Hibernate 's Java
approach in the .NET Framework.

As I understand Java's hibernate allows to conserve, and use the programmed
objects in the SQL relationnal databases's tables.

For .NET, there is somthing similar in LINQ. There is also available a
NHibernate. I am new in this things, can somebody advice me from where to
begin, and in general, maybe .NET has something more powerful to optimise
code's intercation with the database?..

/sergiu

The category of tools you are looking for is called "object-relational
mapping", or "O/RM".

LINQ is actually not an O/RM but a set of compiler extensions for C#
and VB.NET (and some class library extensions shipped with .NET 3.5,
such as the IQueryable interface).

Although LINQ serves also more general purposes, such as better
supporting the functional programming paradigm, the most popular
application of LINQ is using it for building query expressions, that
the C#/VB.NET compiler can parse, validate and compile either to IL
(evaluating the query in memory) or to an expression tree (providing
the means for a tool like an O/RM to translate the query into a
database platform specific SQL dialect).

O/RM tools for .NET can use LINQ as their query language, instead of
their own proprietary query language (which every pre-LINQ existing
tool has, like HQL in case of Hibernate/NHibernate).

Some benefits of a platform provided language such as LINQ over
proprietary query languages are
+) broad existing knowledge about the language in the developer
community (at least in a medium term time frame LINQ will be common
knowledge amongst VB.NET/C# developers)
+) the language can be used in different scenarios, not just for O/RM
(there are a number of APIs provided by MS and third parties, that
utilise LINQ, and the number is growing)
+) integrated IDE support (intellisense, refactoring, etc.) and
compile time checking (this is also true for O/RMs that use the Query
Object Pattern, however this is again proprietary and not remotely as
elegant/readable/convenient as LINQ)


Microsoft already provides a (free) basic O/RM supporting LINQ, called
Linq2Sql. (introduced with the release of .NET Framework 3.5 and
Visual Studio 2008), which is limited to support MS-SQL only.
Some O/RM vendors are already providing LINQ support (like our tool
Genome http://www.genom-e.com), supporting also different database
platforms and providing more complex O/RM functionality than Linq2Sql.
Some other O/RM vendors are working on LINQ support (as far as I know
both LLBLGen and nHibernate are working on LINQ integration).

ADO.NET Entity Framework (EF), mentioned by Michael, is the next
generation of ADO.NET, Microsoft's abstraction for data access
under .NET. Unlike Linq2Sql, it is not (just) an O/RM, but also
abstracts the lower levels of data access, such as the relational data
model (called EDM=Entity Data Model) and the SQL query language
(eSQL). This is a major difference to the abstraction provided by
ADO.NET today, which is basically just wrapping how to connect to a
database (but the connection string is platform specific), sending
commands (but the commands you send, are platform specific SQL) and
receiving data (but the data types received are again platform
specific). On top of the EDM and eSQL, ADO.NET EF will provide several
APIs to access data, amongst them an O/RM called Linq2Entities.
Another interesting feature of EF is that it provides a plugable
provider model for database platform vendors, to translate eSQL to the
platform specific SQL dialect.

While LINQ (and O/RMs supporting LINQ) are released and available
today, the EF is said to be released some time in 2008. If I would
start a project today, I would not hold my breadth for EF, especially
since the basic concepts (like O/RM and LINQ) are already available
today and will not cause dramatic architectural changes in your
project, when EF is finally released.

When chosing an O/RM for .NET I would definitely look for LINQ
integration (either ready or almost ready), to be harnessed for the
future.
Then I would recommend to actually try out the products you have on
your short list in a PoC to verify it fits your development workflow
and architectural paradigms. In larger scale commercial projects
productivity related features like Visual Studio integration, error
reporting, support and documentation are also counting very much.

Greetings,
Christian
 
A

Arne Vajhøj

Some benefits of a platform provided language such as LINQ over
proprietary query languages are
+) broad existing knowledge about the language in the developer
community (at least in a medium term time frame LINQ will be common
knowledge amongst VB.NET/C# developers)

But not as broad existing knowledge as for plain old SQL.

Arne
 
W

William Stacey [C# MVP]

Nice description. As EF (as you say) may be some time off, I fail to see
why they don't open the linq2sql provider to be plugable for other providers
(they already have 4 different sql provider logic paths sCE, s2000, s2005,
s2008 coming). They are 99% there already. They already have the
"Provider=" code to switch logic paths, they just need to add logic to load
the target Provider dll and call some ISqlProvider interface. AFAICT, they
will need to do exactly that to load the s2008 provider unless they plan to
ship a SP for 3.5 that includes the new 2008 logic path.

W
 
S

Sergiu DUDNIC

Thanks, I'll try, certainly NHibernate.

As I understand, this is only "a port of Hibernate Core for Java to the .NET
Framework.", well this is mainly for Java...

Will this affect in some manear the performance of a .NET application, using
NHibernate as a "non-native" .NET product, or something like this?
 
J

Jon Skeet [C# MVP]

Sergiu DUDNIC said:
Thanks, I'll try, certainly NHibernate.

As I understand, this is only "a port of Hibernate Core for Java to the .NET
Framework.", well this is mainly for Java...

Will this affect in some manear the performance of a .NET application, using
NHibernate as a "non-native" .NET product, or something like this?

No, it's a native .NET product. It's been built to use .NET-like from
the start, I believe - just using the ideas from Hibernate Core.

It's not like it's just the Java version built with J# (shudder) or
anything like that.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Also take a look at Subsonic and if you are using 3.5 you have Linq to SQL

Sergiu DUDNIC said:
Thanks, I'll try, certainly NHibernate.

As I understand, this is only "a port of Hibernate Core for Java to the
.NET Framework.", well this is mainly for Java...

Will this affect in some manear the performance of a .NET application,
using NHibernate as a "non-native" .NET product, or something like this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top