Connect MongoDB using Nhibernate in Asp.Net Core - asp.net

Can I use nhibernate to connect MongoDb in Asp.Net Core. Do we need any additional driver to connect mongodb using nhibernate in Asp.Net Core?

NHibernate only works with traditional SQL database providers. You can see full list here: https://nhibernate.info/doc/nhibernate-features. MongoDB is not one of those, specifically because it's a NoSQL solution. There is no way to use NHibernate with it. You should use the API provided by the MongoDb.Driver package directly.

Related

Difference between Entity Framework and Microsoft SQL Server

I'm fairly new to mvc, asp.net, and .net framework in general.
I understand what models are, controllers and views, but what I don't get it is Entity Framework. I developed websites before using php, and when I needed to store some data I simply do that using MySql databases. I thought this is the case with asp.net, same concept but instead of MySql, Microsoft Sql server is used. Now I started to learn .net framework and I watched a lot of online tutorials and saw them using some classes inherited from DbContext to store data! Can anyone tell me where these classes store the data and why don't we use Microsoft Sql server instead?
Entity Framework is an Object Relational Mapping tool (ORM), a layer that sits between your database and code. The idea is that the ORM is database agnostic and will handle writing the SQL for you, so that you could (in theory) swap between SQL Server, MySQL, or whatever database you want with only configuration changes.
You can skip Entity Framework and use SQL directly with ASP.Net. Your tutorials just happen to use Entity Framework.

Asp.net Web API With No Entity Framework

We want to start using Asp.net web api for our future enterprise services however we do not want to use EF for data access.
Are there any samples out there for Asp.net Web APi working with regular ado.net classes instead of EF?
Thanks.
Are you looking for code samples for how to use e.g., SqlConnection, SqlCommand, SqlDataReader?
You would use the classes in System.Data.SqlClient if you are trying to talk to SQL Server, System.Data.OracleClient if you're trying to talk to Oracle, or System.Data.Odbc if you're trying to talk to MySQL.
Here are some code samples for how to call a stored procedure from ADO.NET. Good luck!

ASP.Net: ASPNETDB can I implement LINQ to Sql with this DB?

Very new to membership provider and just implemented on my new web site. I thought it would be nice to be able to use LINQ to query the database. Can I implement LINQ to SQL on that database?
You shouldn't really be querying the database directly. There is a Membership API for that. It uses a pattern called the provider model which means that you can use the same API always and then swap out a different membership provider without having to change your site code.
You might want to do this to use an xml file, or a webservice, or an in-memory provider, but you should still be able to use the Membership API without having to worry about how the data is being retrieved.
If you do want to write some linq-to-sql code then you should write your own membershipprovider:
http://www.google.co.uk/search?q=asp.net+custom+membership+provider
BTW, If you are just getting started then you should be learning Entity Framework really because Linq-to-Sql has been kind of superseded by EF.
All the things rtpHarry said are right, generally you would use the membership API whenever you are within your ASP.Net application.
However, if you are querying your membership DB from another application for some reason, for example if you had a WinForms admin application or something, then you certainly can use Linq to SQL (or Entity Framework).

Mono, ASP.NET Membership provider and Guids

I want to build an ASP.NET site using Mono and a non SQL Server database like Postgres or MySQL. ASP.NET uses Guids in their membership providers for UserIds, and so forth, and Postgres/MySQL don't deal so well with Guids.
What is the most common approach to dealing with Membership providers in Mono, so that user ids can be stored efficiently in the non SQL server database?
It is not a compulsion to to use Guid for userId in membership provider. You will be using official .Net providers. Both (Mysql and Postgres) have well maintained .Net providers. MySql provider has support for membership provider, so if you are using MySql you don't have to worry about Guid. I'm not sure about Postgres.
Anyway you can always implement your own membership provider, which I think is the best solution.
I'm not sure this is a common approach in Mono, but you might want to look at the Altairis Web Security Toolkit on CodePlex. It uses a simplified SQL model that doesn't include Guids. It should be easily adaptable to open source DB's such as MySQL and Postgres with its simple approach.
Altairis Web Security SQL Table Providers

How to integrate an oracle database with an asp.net web application?

How to integrate an oracle database with an asp.net web application?... Any good tutorial to start with?
This link might help you:
In this article, I'll explain the basic yet essential processes
involved in building a C# or Visual Basic .NET application that uses
an Oracle database, including:
How to add project references to support Oracle class libraries in your .NET project
How to create Oracle Database connection strings
How to work with Connection, Command, and DataReader objects

Resources