[英]NHibernate or EF, Shards or manual sharding?

I'd like to know if I'm making the right decision. I'm developing an application that allows the user to mix database entries from a local database (possibly SQL CE or SQLite) and from a remote, shared database (most probably MySQL). Ideally it would have to be flexible and compatible with several database server types (statically as per initial config, not mixing several types dynamically) but this is not a show-stopper.

我想知道我是否做出了正確的決定。我正在開發一個應用程序,允許用戶混合來自本地數據庫(可能是SQL CE或SQLite)和遠程共享數據庫(很可能是MySQL)的數據庫條目。理想情況下,它必須是靈活的並且與幾種數據庫服務器類型兼容(靜態地按照初始配置,不動態地混合幾種類型)但這不是一個顯示停止。

The code is C#, .NET 4.

代碼是C#,.NET 4。

Naturally, I was thinking about NHibernate since it features LINQ in version 3.0, a plus for code readability and efficiency, and the model-first approach is more natural than Entity Framework. It also has Shards for the mixed database part, which should be much easier to handle. The other option is EF 4, which I would otherwise favour since it's fully supported in the .NET context and by Visual Studio, and has a promising future there.

當然,我正在考慮NHibernate,因為它在3.0版本中具有LINQ功能,這是代碼可讀性和效率的優勢,而模型優先方法比實體框架更自然。它還有混合數據庫部分的Shards,應該更容易處理。另一個選項是EF 4,我不喜歡它,因為它在.NET上下文和Visual Studio中完全支持,並且在那里有一個充滿希望的未來。

Is Shards mature enough? It has been stuck to 3 beta for quite a while now and looks like a dead project, have people deployed professional applications based on this extension? Does it have a future? Or is there another option?

碎片是否足夠成熟?它已經堅持3 beta了很長一段時間,看起來像一個死的項目,人們是否部署了基於此擴展的專業應用程序?它有未來嗎?或者還有其他選擇嗎?

Does NHibernate 3 run on Mono? I think so, but an actual confirmation would be great. That would be another advantage over EF if a web server has to be developed as alternative interface.

NHibernate 3在Mono上運行嗎?我是這么認為的,但實際的確認會很棒。如果必須將Web服務器開發為替代接口,那將是EF的另一個優勢。

Thanks in advance for any information or feedback!


Update 1


Apparently .NET 4 is an issue and in order to use NHibernate, .NET 3.5 is wiser. Also, there are clearly issues with SQLite and SQL CE, or other parts of the framework like WPF.

顯然.NET 4是一個問題,為了使用NHibernate,.NET 3.5更加明智。此外,SQLite和SQL CE或WPF等框架的其他部分也存在明顯的問題。

Does NHibernate allows sharding across different database types (for example MySQL and SQLite)?


So I'm starting to believe EF 4 is safer for the client side, and NHibernate when it comes to a possible ASP.NET interface.

所以我開始相信EF 4對於客戶端來說更安全,而NHibernate對於可能的ASP.NET接口來說更安全。

1 个解决方案



Sharding is designed (for a known schema) redirect calls to a known server i.e. names starting with a,b,c,d to server a and e,f,g,h to server b etc.


I haven't heard of it being used cross database server make. I would doubt that this works.


Sharding has it place but I can imagine there might be intermittent issues which are difficult to resolve if different shards have different performance profiles.


There is this link which indicates that it possible to run NH3 under mono ... https://nhibernate.jira.com/browse/NH-2312

這個鏈接表明可以在單聲道下運行NH3 ... https://nhibernate.jira.com/browse/NH-2312

Remote shared database I would tend to abstract away through a known API using WCF or REST.




粤ICP备14056181号  © 2014-2021 ITdaan.com