开发者

What is the equivalent of a JPA implementation in .NET?

开发者 https://www.devze.com 2022-12-29 03:11 出处:网络
I think JPA is nice and conven开发者_JS百科ient ( not to mention standardising, as we used to have every individual programmer doing his/her own thing with a jdbc connection).

I think JPA is nice and conven开发者_JS百科ient ( not to mention standardising, as we used to have every individual programmer doing his/her own thing with a jdbc connection).

I would like to use something like jpa with C# to mysql and sqlserver.


JPA is just a specification for persistence objects and not its implementation. You can see npersistence as equivalent of that on .NET but also you must find an ORM that implemented this specification.


Isn't JPA just a Java ORM?

.NET has many ORM tools, namely

  • ADO Entity Framework
  • NHibernate
  • Active Record
  • LINQ to SQL

and plus my favourite

  • LightSpeed


To answer the part "to use something like jpa with C#" I recommend changing the approach. JPA, as highlighted in comments, is a set of specifications to allow ORM interoperability.

While NPeristence exists, trying to fill the gap between Java and C#, there is no point in using "yet another JPA" when industry doesn't adopt it as a standard API.

It's like if you ask for using Java language features in .NET (like "can I implement an anonymous interface in .NET?"). You must live with the fact that a de-facto standard JPA equivalent for C# does not currently exist because 1) there are two major ORM "vendors" (NHibernate and Entity Framework) and 2) EF doesn't adopt NPA.

If you need DB interoperability between MSSQL and MYSQL one of the two open source product above will suffice, but is a whole thing to learn.

My boss said that to learn Java I must start forgetting C#. I suggest you the opposite: clear up your mind, start from scratch, and see that powerful tools are available for your needs.


Exist the equivalent for C# and it's called NPA (.NET Persistence API), here some Links:

  • WikiPedia
  • NPersistence


Entity Framework is what you should check out first. It is recommended by Microsoft.

Other popular options include NHibernate or DBLinq.

http://community.jboss.org/wiki/NHibernateforNET

http://www.nhforge.org (later versions)

http://code.google.com/p/dblinq2007/


.Net Persistence Api is the equivalent in .Net. Both JPA and its .Net counterpart are set of specifications which ORM vendors or open source community can implement. Hibernate is one of those implementation like we have Entity Framework in .Net. When you switch between two ORM frameworks that adhere to JPA, you wouldn't expect any changes in code to accommodate this change as both follow the same underlying specification.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号