tips for ASP.net MVC And Data Model [closed] - c#

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 8 years ago.
Improve this question
I need your opinion on which is better. In an ASP.net MVC project, is it recommended to have one DataModel for my whole database or one for each table in my database?
Note : I'm using EF dataFirst Model with a oracle database.

Lolz thats a nice question. I think you are new to MVC and EF.
Use one DataModel for the whole Database. Entity Frame work supports Oracle databse.
One DbContext represents one database. But, you can have mutliple databse in your project. So, you will have their respective DbContext's.
there are three approch to work with entity framework :
Model First
Data First
Code First
Configuring and using different approches are explained here
https://www.simple-talk.com/dotnet/.net-framework/different-approaches-of-entity-framework/
But, I personally prefer Database First.
If you want to learn more abt ASP.NET MVC with EF look here, Its with Data First
http://www.codeproject.com/Articles/695850/Complete-CRUD-Operations-in-MVC

Related

Best practice to integrate existing MSSQL db into Umbraco? [closed]

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
This is a general Umbraco architectural question, not a specific-to-the-line-of-code-question.
I am new to Umbraco but know my way around .net and asp.net mvc well.
For an upcoming project I am considering using Umbraco as a cms but as my experience with Umbraco is little, I cannot quite oversee what my options are when it comes to integrating an already existing mssql database.
The database that will support the Umbraco installation already has some tables present, containing product information. What is the best way to expose this data using the Umbraco api/models and subsequently integrate this data in Umbraco views?
E.g. can I create data models in the Umbraco admin and map those to the existing tables or is there another way that is considered to be a best practice?
Thank you.
I don't have a lot of first hand experience with this subject but I recently did an Umbraco bootcamp that covers exactly this, it's called "Umbraco Application Integration".
The course talks about Route Hijacking and contentfinders for mapping the external data into the umbraco request pipeline.
To call the external tables from you code, you can look into Umbraco's integrated lightweight orm called peta poco, but with a little work Entity Framework or nHibernate can also work.
To intergrate the external tables into you umbraco backend, there's a plugin called ui-o-matic that could help you out
Hopefully this puts you on the right track :)

How to: CRUD Using AngularJS and MVC Web API [closed]

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
I would like to use AngularJS and MVC Web API to create a form and its CRUD operations (see image below)
The form is constituted of three tables: Page, Preamble, Sections. It also has 3 drop down lists that will need to be populated from the database.
This is my first attempt to create a project like this one, and I am finding lots of examples and most of them use only one table.
Do anybody has an tutorial/ example in which more than one table is used?
There are lots of Angular tutorials at the end of a Google search, but can I suggest that you not think of your page controls/layout as being sourced from tables in a database but more as results returned from an API call (actually you shouldn't even be thinking about it like that, but it will start you on the right road) - ultimately these values may well be formed as a result of some database query but from the UI perspective that's implementation detail that it shouldn't be privy to.
Rather than:
Title, SEO Title, Percent Page = "Page Table"
Consider:
Title, SEO Title, Percent Page = api/pages/{page}
Then the implementation behind api/pages/{page} is hidden from the UI and so not tightly coupled to the database schema.

Working with a very large existing database in Entity Framework [closed]

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
I'm trying to design a DAL for an existing application that works with a very large database (has around 800 tables, another 500 stored procedures, lots of views and user functions). I also want to enable the use of migrations for changes moving forward.
This is what I came up with:
Use EF Power Tools to reverse engineer the tables into EF entities in a temporary project
Enable migrations in that project.
Add the first migration, which scaffolds the creation of every table (unfortunately, leaving out default values for columns)
Separate entities into separate models (each model would have its own project and its own context class)
Enable migrations on only one of the models. Do all changes there.
Add a migration and copy the content of the migration that was scaffolded earlier.
Does this sound like a good plan? What would you change?
This would only help create the tables, though. If I want the whole database to be created with that initial migration, how could I add the creation of stored procs, views and user functions to this initial migration?
Because of this, I'm thinking that the best option would instead be to have a backup of the initial database, restore it whenever I want a new database setup, then run migrations to upgrade to current version.
What is the general approach to solve this problem?

Custom objects for model in asp.net mvc 4 [closed]

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 am learning MVC. In this tutorial, entity framework is used form the 'model' part. I am used to OOP in programming. So, i would like to use custom objects instead of entity framework. Is it possible at all?
Sorry if this a foolish question.
an mvc action injects what it wants in a view.
return View("test");
A razor view can display whatever was injected in it.
<body>#Model</body>
Is it possible at all?
Of course, MVC is in no way bound to Entity Framework. It's even advisable to create your own ViewModels, instead of using entity classes for that.
Yes, you can use custom object as model but you need also a layer to access real data.
EF allows you to create model and provides a framework to access/modify data.

EF is Database driven development? [closed]

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 9 years ago.
Improve this question
Is 'Database Driven Development in windows' same as Application development uses Entity Framework. or is this (DB Driven Dev) has to use different framework or design?
Please comment. Thanks.
Database Driven Design is basically where you have the database design done first, then you program an application based upon the database. Database driven design
Entity Framework is a Object Relational Mapping tool. Using EF, you can do a "code-first" database design where EF will create your database for you, but that's still not database driven design.

Categories

Resources