nhibernate and generated GUI - nhibernate

Does a framework exists that will auto generate (runtime or designtime) a simple CRUDE GUI from my nhibernate mappings and domain? Open source and in c#

MVC Scaffolding package is for Entity Framework, but the T4 templates are editable. You might be able to modify them to use an NHibernate session instead of the EF DBContext. Everything else generated should work pretty well.

Related

How can I connect to an external SQL database using Blazor without using packages (like Entity Framework)

I'm not even sure if this is possible but Google has been unable to help me. It may just be because Blazor is so new. Anyway, I've got a premade database and I want to connect to it directly like how you can open a connection, run some SQL, then close a connection in ASP.NET. I, unfortunately, can't just make a new database using code-first as most tutorials tell you to do.
Two options that spring to mind is the Entity Framework Core (Database First) or Dapper.
I'm actually connecting to an existing database using Dapper in my Blazor projects and there are better Dapper examples/tutorials available however the below is a basic example.
https://github.com/DotNetDublin/BlazorServerSide/tree/main/BlazorServerSide
If you don't want to use either Entity Framework or Dapper you can use ADO.NET.
The below tutorial is for MVC however the code for interacting with the database would be the same. See StudentDataAccessLayer.
https://www.c-sharpcorner.com/article/crud-operations-using-asp-net-core-and-ado-net/
use the ef command Scaffold-DbContext

.net core 3.0 Auto migration does not create/update/ datatable automatically

I am building a project template using .net core 3.0 and Microsoft.EntityFrameworkCore.
this will just created the database schema not the data table
if (!context.Database.EnsureCreated())
context.Database.Migrate();
Do we have an automatic migration that helps to create/update datatable without needing to manually call
Add-Migration
Update database
I was able to build it automatically in .net using Code base EF6, it will just detect if you have created a new field in the model and add it to database automatically.
Do we have something in .net Core ?
Thanks
Do we have an automatic migration that helps to create/update datatable without needing to manually call Add-Migration Update database
As far as I know, automatic migration feature has been removed in EF Core.
And DbContext.Database.Migrate(); just help apply any pending migrations for the context to the database, which mean that we should created migration(s) first otherwise it would not work.

Entity Framework version 6.1.3 not getting open

I am building an empty MVC application using .net 4.5 framework VS 2012. Then I add entity framework version 6.1.3. After adding I right click on the models folder to add a new entity model. It opens the entity data model wizard where I am selecting "Generate from database". Then it is taking me to choose your data connection , but after a while its automatically closes. I don't know where's the problem is exactly. In web.config file I also changed the entity framework version from 6.0.0.0 to 6.1.3.0 , still it is getting close and not allow me to select my database. I tried EF version 4.0 and 5 as well but the same problem . I have one existing application on VS 2012 with EF version 4.4.0 , where some databases are already there. I have tried adding one more database there and it is adding there. then why not adding on my new application having the same configurations. What would be the problem ? Any help would be very much appreciated.
finally I found the answer after working around it for hours. what we need to do is , Go into view->Server Explorer and remove any "Data Connections". Then this worked again.

Thinktecture IdentityManager choosing a db schema

I recently setup a dev site and am using IdentityServer3 with IdentityManager, both from thinktecture, and IdentityManager is designed to create the database for itself, but can be configured to work with an existing db. I was able to get IdentityManager into a local db I had previously created with the default schema, but I would like to switch it to a new schema. Basically the question is that I can't figure out how to set the desired schema in the db in IdentityManager and can anyone in here give any insight?
There are many ways to do this (idsrv3 is very configurable). A common way is to add the MembershipReboot package, subclassing the MembershipReboot factory classes, and then loading your new factories during the idsrv3 startup. You will also need the IdentityServer3.MembershipReboot project, which acts as a go-between between IdentityServer3 and MembershipReboot.
In the visual studio package manager console you add the projects like so:
Install-Package BrockAllen.MembershipReboot
Install-Package IdentityServer3.MembershipReboot
You can use the idsrv3 samples as an example of how to set up your classes. https://github.com/IdentityServer/IdentityServer3.Samples
That will give you the data entities you need. Then to write your entities to a database, add the MembershipReboot.EF project and set up a database connection string that gets passed to your override of the MembershipRebootDbContext() class.
Install-Package BrockAllen.MembershipReboot.Ef
The first time you start your identity server, MembershipReboot.EF will use Entity Framework to automatically create your database schema and start writing your entities there.
Hope that gets you started, sorry if it's not what you're asking!

Does nHibernate allow drag and drop automatic class creation like linq to sql?

Just a basic question. Learning Linq to SQL and some nHibernate. I am using the mvc tutorial and they drag and drop tables onto the visual studio designer to create the classes and wire up everything.
When I experimented with nHibernate I had to do lots with xml files. Does nHibernate have anything that is "easy" like Linq to SQL or is this drag and drop for Linq to SQL so basic that when I want to do something "real" it won't matter that Visual Studio does this for me (at this basic level)? In other words, the further I go with Linq to SQL, I'll eventually have to handle config files like I do with nHibernate.
Look at Castle's ActiveRecord framework. It replaces the use of XML config files with the use of Attributes directly on the class/property declaration. Also, a tool called ActiveWriter integrates with Visual Studio and allows connecting to a data source and generating the object model!
There is no "native" support like you see with LINQ to SQL. However, there are third party add-ins that will allow you to do something similar with nHibernate. My favorite is this one:
http://sourceforge.net/projects/nhibernateaddin
To use it:
Create a data connection to a
database that contains the structure
you are going to code against (your
development database).
Add a new NHibernate plug-in item
(via add new item) to your project
that will contain you domain objects.
In the property window add the data
connection string from the data
connection you just created (this
isn't automated yet).
Finally, you drag and drop your tables
from your data connection to the
NHibernate plug-in object and when
saved your mapping files and you
domain objects are generated. To use
it you create a data connection to a
database that contains the structure
you are going to code against (your
development database).