I have a asp.net application which is written in the traditional method [SqlConnection. SqlAdapter.. ..] in data access layer, I can see that every time we are making a connection and using adapters. Code is written in a very dirty manner. I have been given the task to re write the application in standard/best practice way.
i have all stored procedure already written, is there any way I can use a tool like which will help me in writing the business layer and data access layer?
I suggest you to go for codesmith. As you have all the Stored procedure already written you can either go for the LINQ to SQL feature.
For the DAL, you could use Entity Framework 4. The business logic could be wrapped up by hand.
Take a look at fluentAdo.net. You can use it with all your old stored procedures.
But if you really want to rewrite your app, I suggest you to use NHibernate or Entity Framework. They have pretty same set of fetures.
Related
I want to create a web application, all actions (Create, Update, Delete) should be done using SQL stored procedure. Every action in the web just calls a stored procedure and receives json data to render the view.
So what is the best framework that I can use? Please help
So what is the best .Net framework that I can use?
Every .Net Framework has ways to retrieve data from database. So, it doesn't really matter what version of .NET Framework you use.
I believe you would like to know what kind of library you should use for Store Procedures. If so, you might want to look at Dapper ORM.
Dapper ORM is created by Stack Exchange, and used in a lot of sites including Stack Overflow.
It basically is a wrapper around ADO.NET to map SQL result to strongly type object. If you have to do the mapping manually, it is very tedious and error prone process. So, I highly recommend using Dapper ORM if you have to call Store Procedures.
I am a winforms programmer and need to setup a data access website for our sql server database. The database contains weather data (wind, temperature, etc..). I would like users to be able to select a start and stop date and the to download the dataset. I know this should be simple to build, but I would like some advise on what is the best technique.
Do I need entity framework? We have a license for Developer Express ASP.NET. Any ideas to use, since I am totally confused about all the options available and I haven't build any ASP.NET website in a long time.....
Thanks,
Erik
For a first pass/prototype, I'd suggest you use ADO.Net and see how it runs with your datasets. Then, once things are clearer I'd maybe look into an ORM. Based on the use case you mention ORM might be overkill.
Yes with license for Developer Express ASP.NET. you can use Entity Framework
If you want work with ORM technology. mapping relational object; yuo have wizard who facilitate your cretaion of database and mapping
http://msdn.microsoft.com/en-us/data/ef.aspx
You can also use just ADO.Net with adapter of datas, stored procedure, dataset datatables, etc....
What are the required steps to use SimpleMembership (ASP.NET MVC 4) with RavenDB (or other databases) instead of SQL Server?
I am used to override the MembershipProvider but how does it work with the new SimpleMembership?
I saw there is a SimpleMembershipProvider so I think I should override it, but I don't know if the methods are for storing data purpose only or if they should contain business/validation logic)...
What about configuration? I know the InitializeDatabaseConnection method is normally responsible for initializing the whole shebang, but I don't think I should call it if I don't use Entity Framework.
Unfortunately, I did not find a lot of resources about the new SimpleMembership except two links which have not been very useful:
http://igambin.blogspot.ca/2012/08/simplemembershipprovider-huh.html
http://blog.osbornm.com/archive/2010/07/21/using-simplemembership-with-asp.net-webpages.aspx
So here is what I found after looking at some of the the source code (MVC4).
http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/553690ac9488#src%2fWebMatrix.WebData%2fExtendedMembershipProvider.cs
SimpleMembership is an implementation of the abstract class ExtendedMembershipProvider.
The code inside SimpleMembership is mostly SQL operations and some calls to the underlying (called "previous" in the documentation) MembershipProvider.
I don't think it is of any use (in my case) to override SimpleMembership as its implementation is mostly tied to SQL Server. Instead, for what I understand, I should implement ExtendedMembershipProvider. Then, by setting this implementation in the web.config file, the WebSecurity helper would bypass SimpleMembership (default implementation) and call my implementation of the ExtendedMembershipProvider.
I don't think I will do this any soon since it looks even more complicated than before (more methods to implement)... but still doable.
However, all this said, I'm a bit disappointed that we still have to work with the MembershipProvider which, IMHO, is far (a lot of static and internal stuff) from the whole dependency injection thing that we love so much with ASP.Net MVC/WebApi.
Edit 1
This question was aked before Jon Galloway wrote this tutorial :
http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
But my answer stays valid as this (taken from Jon Galloway article) resumes it:
Note that SimpleMembership still requires some flavor of SQL Server -
it won't work with MySQL, NoSQL databases, etc. You can take a look at
the code in WebMatrix.WebData.dll using a tool like ILSpy if you'd
like to see why - there are places where SQL Server specific SQL
statements are being executed, especially when creating and
initializing tables. It seems like you might be able to work with
another database if you created the tables separately, but I haven't
tried it and it's not supported at this point.
Here's my implementation for mongodb. Maybe it can help
https://github.com/malibeg/MongodbSimpleMembershipProvider#readme
SimpleMembership is not really meant to be used with the old MembershipProviders as it doesn't fullfill all of the same contracts that are assumed of normal MembershipProviders. Its mostly designed for use via the WebSecurity helper.
This link might be helpful for more info: Web Pages Tutorial
In Asp.net can we use Ms access as back end, can we do manipulate the data if we use back end as ms access.
Sure, but I certainly wouldn't call MS Access directly from your asp.net code behinds.
Take a look at something like the MVC or MVP models as a place to start. Call services which call the data layer instead of coupling your front end to any particular data store.
You can use MS Access as your back end, yes.
I certainly wouldn't suggest it though. There are many other compact choices (such as SQL Server Compact Edition or SQLite) that I would consider more stable and robust.
Yes you can use MSAccess.
You will find more about Retrieving Data Using the AccessDataSource here. Also have look at this article about ASP.NET Data Access Overview there you will find about AccessDataSource Class
Hope this helps
You can make use of Access for sure. In the past, with classic ASP, this combination was quite frequently used for small websites.
If you want to keep on using Membership, roles, ... then you can also do that with Access as there are already providers available for that. Take a look at this article on how to grab the providers and make use of it in your application: Using Access instead of SQL server for your ASP.NET Application Services.
I have ASP.NET project and I want to know what is better to use.
ODBC connection and with Server Explorer (drag and drop make DataSet and modify it) or do some DBconnect class with connection to database, queries and use it for GridView?
When I use server explorer, I don't have good feeling because all logic is on aspx page and I do not separate from the application layer logic layer.
It will be a lagre application, databese(PostreSQL) have 18 tables and difficult constraints and application have to generate some documents etc. .
"Better" depends entirely on your situation. Is the purpose to get something done as quickly as possible for internal users at your company, or is this going to be a commercial site that will need to be highly extensible and needs to be as easy as possible to maintain? Will you need to integrate with other platforms possibly built using other languages at some point? The answers to all of these questions should affect your decision.
If you're looking to separate your project into distinct layers, then I would recommend an ORM such as NHibernate or Entity Framework (there are other commercially available ORM products out there, but these are the ones I'm familiar with and which you can easily get help with on this site).
Create a DataSource with LINQ to Entity. It let you the liberty of LINQ with the peace of mind of when you change something il will break your build so you will be able to debug more efficiently.
Well if you have total flexibility, I would recommend using C# ASP.NET 4 with MVC3 razor for the UI and application code. Use Entity Framework 4.1 code first for the data access layer.
This way you will always work with real objects that you create, and with List<realtype> instead of the total mess that exists with datasets.