custom ADO.NET data provider with NHibernate - nhibernate

I am writing an application that connect to ESRI's File Geodatabase, which is a proprietary database.
I found a custom ADO.NET data provider for this File Geodatabase.
I like to access this database with NHibernate.
Can I use this ADO.NET data provider with NHibernate without writing any customization code for NHibernate?
is there a driver that deal with generic ado.net provider?
so far what I found, they told me to implement IDriver, and IDialect in order to acheive that.
And in case I have to write my own implementation, is there any document that describe how to do that?

There is a GenericDialect (not quite full-featured, as few things are less standard than SQL), but you need to implement a driver so NH can connect to the db.
You can take any of the simpler drivers in https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate/Driver as a starting point.

Related

How to force creation of OpenIddict tables in not empty DB

Does anybody know whether there is a way to use default OpenIddict storage functionality in a project which doesn't use Entity Framework and has not empty DB?
I'm trying to integrate Openiddict server to my Web App. The app has a DB, but communication with it is done using classic ADO.Net. I tried to find a similar example in the openiddict-samples repository but unfortunately without result.
I know that I can implement my own TokenStore, ApplicationStore etc. and register them via extensions for OpenIddictCoreBuilder but I'd like to use the default implementations in case it's possible to do that with not empty DB and without EF or with EF but for Openiddict functionality only. My DB is quite big and it's not an easy task to migrate it to EF.
I tried to use code from existing examples but those didn't work in my case. What I found out is that it works with empty DB only, otherwise OpenIddict tables are not created.
So I would very appreciate for any advice or link to example which I should investigate more carefully. So to say make OpenIddict to create its tables automatically, under the hood.
P.S.: I of course can copy those tables from examples and include scripts for their creation in my app, but I'd like to use the built-in functionality as much as possible.
OpenIddict version: 3.1.1
It seems that for now there is no a built-in functionality to achieve the wanted behavior. The only way is to create own Stores and StoreResolvers for OpenIddict and migrate tables creation to any suitable solution: a set of sql scripts, some kind of migration (e.g. FluentMigration), etc.
For now OpenIddict out of the box supports EF and Mongo only. This implementations can be considered as examples for implementation of Stores and StoreResolvers.

Multiple database with NHibernate 3.x

I found a couple of articles how to use NHibernate with multiple database, for example this one
http://codebetter.com/karlseguin/2009/03/30/using-nhibernate-with-multiple-databases/
But all articles are very old, and may be there is some new approach with NH 3.x? I looked in documentation but did not found anything, but maybe i missed somthing?
Does anybody knows some better way (native NH3.x way) to use NH 3.x with multiple database than described in this article?
http://codebetter.com/karlseguin/2009/03/30/using-nhibernate-with-multiple-databases/
Thanks,
Alexander.
AFAIK, there is nothing new in NH 3. But there are still more options to use several databases than in the blog post you linked.
You can open your own connection and pass it to NH when opening a session.
You can open a session and switch to another database on the same server (eg. by executing a use database statement on sql server).
You can provide a schema (database) name on each table you map in the mapping file. It is not useful to have it hard coded, but you can still replace it after loading the mapping files or use mapping by code.
The articles you linked are still the way to go. Each SessionFactory is responsible for a single connection (connectionstring) and schema.
There is one special case where ou split the database into multiple with the same schema to load balance. This is called sharding and there is the contrib NHibernate.Shards to deal with it.

entity framework, self-tracking entity and sqlserver file stream

I just start a project where I need to have a WCF services that read and write files.
The architecture is based on DDD using Entity Framework Self-Tracking Entity.
The simple GUI should show a grid with a list of file and then click the row you can download it.
Can I use the file stream sql server 2008 feature with this architecture? Which strategy is the best one to manage this kind of entity?
Thanks.
Filestream will not help you when using EF. EF doesn't use streaming feature, it loads it as varbinary(max). If you wan to take advantage of filestream you must load it from database with ADO.NET directly and you need a streaming service to pass it back to the client in efficient way.

Data provider class for sql database

I need to write a data provider class to pull data from a sql database for use in a webpage that will display a bing map. Does anyone have a link they could provide with a tutorial on how to do this?
I have very little experience using a db to provide dynamic data for a web page so any help is appreciated. The Database is a sql Azure databse.
You need to research Data Access in .NET and ORM technologies for .NET. This question deals with similar concepts.
Simple Data Access Layer
Note: There is nothing "special" you need to do to apply the standard .NET data technologies to Azure SQL.

ADO.NET Data Services & Oracle - RESTful WCF w/ Oracle

I'm looking into WCF and woud like to created my framework in a RESTful way. I've just started looking into ADO.NET Data Services, but it seems it only supports SQL Server, is this correct? Can you run in against Oracle?
ADO.net Data Services and WCF both feed off a model. You can provide restful access to your data using a proper model layer that accommodates Oracle driver. Things might not work out of the box. In WCF you can use an Oracle friendly mapper like NHibernate and expose your datacontracts in a restful way. For Astoria you might need to hunt for a EF provider for Oracle db. But its possible.
EDIT: It seems ADO.net Entity Framework is already Oracle friendly ! You have no problems going pure WCF or Astoria way
Please see the following question for a more up-to-date and thorough answer.
Is it possible to expose data from Oracle using OData?
ADO.NET Data Services relies on the ADO.NET Entity Framework, and that definitely also supports Oracle. WCF in itself is totally database-agnostic - no limitations here. I don't see why you shouldn't be able to use ADO.NET Data Services with an Oracle backend.
Marc
Here's a link on how to do so -
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkWCF/WCFEntityFramework.htm
You'll actually need to install ODAC for EF, which is currently in beta:
http://www.oracle.com/technetwork/topics/dotnet/downloads/oracleefbeta-302521.html
It works fine for me in VS, but not in IIS, which is the issue I'm facing.
HTH