Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am trying to use this gigantic bloated monster of a library, Identity, but I don't want to use entity framework. So I got NHibernate.AspNet.Identity!
I think I'm almost athe point of getting it to work but I can't seem to figure out how to generate the schema for the DB.
I thought it would automatically populate the DB with tables on first run. I was wrong...
Does anyone know where I can generate/find the schema for the database? Thanks!
Have you tried to use SchemaExport or SchemaUpdate (supports migration) classes from NHibernate.Tool.hbm2ddl? You may find usage example at What is schemaExport in Fluent NHibernate? and Fluent NHibernate - Create database schema only if not existing
In a nutshell the code for FluentNHibernate looks something like (and is similar for XML-based configuartion)
Fluently.Configure()
.Database(/* configure database */)
.Mappings(/* mappings */)
.ExposeConfiguration(cfg => { new SchemaExport(cfg).Create(false, true); });
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I tried to update model/table in the ORM but it still shows there even after updating it.
I don't know what is the problem in this even i have changed the table name and deleted my models using select all then delete in the ORM and removed EDMX as well but still same issue persists.
Found the solution to my answer as i was creating table without primary key so it didn't add it in the ORM.
Using primary key worked with me.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
After reading forums and articles, I found that using the Entity Framework
you can quickly create a database, and ADO can be used to conventional SQL queries and get accurate results. Also there are many questions all over the internet: what is better, ADO or EF? And in responses saying that need to combine these two technologies, each in its own good. But here's the question of how combine these two technologies and use them in the same project?
For example, i have several tables that mapped to entites, like employee and tasks. With EF i can create new employees and add them to database. But what if i want to create a report, that can be easely created with complex SQL query from many tables. The result of this SQL query can't match existing entities, so what to do? Create new entity-model to match this report and create this LINQ query to build it, or use ADO and SQL query?
EF actually use ADO deep inside itself.
If you want to execute plain SQL in EF you can use theese methods:
SqlQuery() //for selects
ExecuteSqlCommand() //for Delete, Insert, Update
Check msdn.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
which one is more useful for a project with a huge database
useful means :
Insert and delete and update fast
select a lot of rows fast
update database structure easier
programmer friendly
, .....
we have considered that database implement is in the best situation of indexing and ....
thanks
From http://forums.asp.net/t/1647988.aspx:
DAAB is the Data Access Block provided by Ent. Lib.
They are completely different animals. The DAAB is a data access library (wrappers around ADO.NET), whereas the Entity Framework is an Object Relatonal Mapper. They don't do the same thing. If you want to use a data access library, Microsoft would recomend the Entity Framework. If you want to use an ORM. they would recomment EF.
Other similar question on here:
Entity framework vs enterprise library
General Questions about Entity Framework vs. Enterprise Library & a few others
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have been trying to update the database when we deploy the application on the client's machine using sql queries. Now i want to update the database automatically. Is there any way to do this, i have heard of SQLMigrations but they say that it can only be used with Code first approach. Can anyone shed some light on this topic
You can use a Database Project in Visual Studio. With Database Projects, you can generate SQL Scripts for any existing database, you can create difference (update) scripts, you can add SQL scripts of your own, etc.
Database Projects are extremely handy in many scenarios. Check out this link on MSDN: http://msdn.microsoft.com/en-us/library/xee70aty.aspx
There is also guidance on CodeProject about this: http://www.codeproject.com/Articles/245612/Creating-a-Database-Project-with-Visual-Studio
You'll love it!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm working in a project that uses .NET Entity Framework 4 with EntityObjects. Since we have found that we need to evolve into self-tracking entities for the remaining modules that haven't been implemented, I want to ask this:
1) Can we delete the existent plain entities and regenerate self-tracking entities from the database without modifying our currently written code using them?
2) If the answer of 1) is 'yes', is that easily done? How would you proceed to migrate from the first scheme to the second?
Change the namespces of your existing POCO classes to the one you expect EF will generate and so that your references will be updated.Then delete old POCO classes and generate EF classesThen compile your solution
By plain entities i presume you mean POCO's. You probably need to delete the POCO classes u wrote or generated and set the build action of the edmx file to EntityDeploy.
Hope this helps.
You just have to remove any old T4 you may have used (if you used POCO T4), and add new self tracking POCO T4 from your model.
It should be enough to work.