Is it possible to use Model binder features of Asp.Net 4.5 without using Entity Framwork?
If yes then how, no then why?
Currently we are using plain sql query to retrive/update/insert/detele data to/from database.
now we require to use Model Binder feature in our application without EF.
Can anyone tell me whether this is possible or not?
it would be good if you provide small examples.
Related
Newb here sorry. I'm reading up Entity Framework Core, npgsql and PostgreSQL (new to all of these things!!) Can someone please very kindly explain or point me where to read: I am trying to create a brand new database using code.
From the things I have read, I am creating the DB using pgadmin or script directly. What I want to do is create a database all via code (so the user can install Postgresql and my website but not have to worry about any direct SQL commands with PostgreSQL).
Thank you!
There are two ways to have EF Core create the database:
Use the lightweight EnsureCreated() method, which simply creates your database base on the model. If you're just starting out, it's probably best to start here, see the docs.
Use migrations, which also take care of updating your database schema as your code model changes. For example, if you add a property to one of your C# classes, EF Core can automatically generate a migration that will add the corresponding column to the table. Here are the docs for that.
The general docs for this are here. As a general rule, read and understand the EF Core docs first, then you can look at database- and provider-specific details (e.g. PostgreSQL/Npgsql).
So I have to make a asp.net project with SQL Server database, the problem is that I have to do it without any ORM-with a specific DB controller and I have always used the Entity Framework which IS an ORM.
I have no idea from where to begin. How do I collect the data and send it the controller with the html.helpers and how to structure the db controller?
I am not allowed to use Linq either just SQL. As much as I can see from the others questions I should use the SQL command class but its not explained structurally.
What I am asking here is just for the basics.How do I get it from the html helper to the database without ORM and what will I need for that as clases and models,how to relate them and if possible for a simple example.
As you mentioned, you can use "classic" SQL commands with ADO.NET. Here is a good example:
Using ASP.Net MVC with Classic ADO.Net
Another way, and in my opinion a very fast and convenient way, is to use the Dapper framework.
I would recommend you to use Dapper with Stored Procedures. It's a good trade-off between ORM (like Entity Framework) and classical SQL commands. I can show you an example if you give me a business case.
I've been searching all over trying to find a reasonable and working solution to this.
I've created a new Database using EF6.0 (VS 2013) using a Model First approach. This model was created in the WPF application that will utilize the database. I have been unable to successfully implement any type of data validation (I've done data annotations in ASP and EF, metadata classes etc), however, I've been unable to get my meta data classes to be utilized.
Does anyone have any straightforward write-up/article/blog/etc that has a firm and VALID example of how to use EF6 Data Validations to drive notifications to the UI in a WPF application? Any assistance would helpful, or perhaps, better advice on data validation. I could easily write custom validation logic to check the entity before attempting to persist to the database, but this seems counter intuitive to the idea of the Entity Framework and its built in validation attributes.
Are your mapping files created using Fluent API or data annotations?
Maybe you can implement IValidatbleObject interface, or you may use the FluentValid library.
Check this answer How do I use IValidatableObject?.
Hope that helps.
I have a WCF application in C# .NET 4.0. I made all my entity classes and can query a sample from the WCF. The sample is just hard coded values.
Now I am ready to persist these in the database. I am lost on how to approach this though. I plan to create tables for each entity class I created, but what is the best way to add the persistent data layer to my existing WCF application. Is Entity Framework a good choice for this? Thanks for any help or suggestions.
What I suggest is to use entity framework code first. It prevents you from re-creating the model/database by hand. Just set it up so that your current entity classes are mapped to the entity framework and it will automatically create the database for you.
If you google entity framework code first, i'm sure u cant miss it.
I have a requirement in which in order to make an application extensible and reusable, I have to create a provision through which a user would be able to provide a business object structure (the fields, their types, etc.) through an XML file and using that structure the UI (i.e. the controls and the complete page), the data updation methods (CRUD) and the database (i.e. the tables and the SPs) can be dynamically generated automatically in order to cater to the business object.
I've 'only' heard about Entity framework, LINQ, etc. but do not know if they'd be any helpful in achieving what I wish for.
Any suggestions or guidance on how to approach towards this design goal would be highly appreciated.
Thanks a ton!
You may want to take a look at ASP.NET Dynamic Data. It still requires you to provide it an Entity Framework model, but you can dynamically generate the model using the EdmGen.exe tool.
Here is some info about each... Follow the links more more detail.
ASP.NET Dynamic Data
ASP.NET Dynamic Data provides a framework that enables you to quickly build a functional data-driven application, based on a LINQ to SQL or Entity Framework data model. It also adds great flexibility and functionality to the DetailsView, FormView, GridView, and ListView controls in the form of smart validation and the ability to easily change the display of these controls using templates.
EdmGen.exe
EdmGen.exe is a command-line tool used for working with Entity Framework model and mapping files. You can use the EdmGen.exe tool to do the following:
Connect to a data source by using a data source–specific .NET Framework data provider, and generate the conceptual model (.csdl), storage model (.ssdl), and mapping (.msl) files that are used by the Entity Framework . For more information, see How to: Use EdmGen.exe to Generate the Model and Mapping Files.
Validate an existing model. For more information, see How to: Use EdmGen.exe to Validate Model and Mapping Files.
Generate a C# or Visual Basic code file that contains the object classes generated from a conceptual model (.csdl) file. For more information, see How to: Use EdmGen.exe to Generate Object-Layer Code.
Generate a C# or Visual Basic code file that contains the pre-generated views for an existing model. For more information, How to: Pre-Generate Views to Improve Query Performance.
Check out lightswitch:
http://www.microsoft.com/visualstudio/en-us/lightswitch
commercial product: Enterprise Elements Repository