Way to use Entity Framework with Classic Asp - entity-framework

In my company, we have almost all the systems running on classic asp with the logic layer in dlls made by vb6. We use sql server and it's used via stored procedures.
Recently I found how easy is to connect to a procedure using entity framework, and we are trying to avoid the usage of vb6, and for tests purposes, i create a project in .net similar to the ones we use in vb6 with entity framework connecting to the procedure, and generating the tbl and using regAsm to register the dll, I could use it in the classic asp, but when i try to access the method that access the procedure, it gives me the return:
No connection string named 'xEntities' could be found in the application config file.
Where xEntities is the name of my context.
We can't migrate everything to the asp.net because of the time, but it will be very good if we stop using vb6.
Any suggestions?
Thanks.

Have you tried creating a web.config file with the appropriate Entity Framework sections in your web site folder? It is possible to have a web.config in a folder with an ASP Classic web site.

Related

Use ADO.NET Entity Model (.edmx) in Blazor .Net Framework

I like to use a previous ADO.Net Entity Model, stored in another project (in the same solution) and imported like DLL in Blazor's ASP.NET Framework (not Core).
Unfortunately when i try to connect my context I receive that error: "No connection string named 'MyDBEntities' could be found in the application config file.".
I tried to configure appsettings.json:
"ConnectionStrings": {
"MyDBEntities": "xxxxxxxxxxxxxxxxxxxx"
}
and the startup.cs:
services.AddScoped<MyDBEntities>((_) => new MyDBEntities(Configuration.GetConnectionString("MyDBEntities")));
What am I doing wrong?
After some research, the best solution for implement a system like ADO.NET in .Net 6 with Blazor is to use EF Core Power Tools, a useful design-time DbContext features for connect your DB (in my case is SQL Server) and automate the creation or update of your tables.
It's very simple to install, configure and use like ADO.NET.
For more information about how install in your Visual Studio Solution, here is the link:
https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools

ASP .Net Identity and Entity Framework Database

I'm developing an event page using entity framework and asp net identity 2.0 and I'm new also with this kind of tools.
If I create a new project that using template visual studio, it's automatically create a DB with several table. and also there are many code that I don't need in that template. (template -> project mvc with already installed authentication).
I've read several tutorial, but for creating from scratch my step is like this :
Create a DB
Create simple mvc project and install package nuget for asp net identity and EF framework
Set the connection strings
Create the code and EF will automatically created the table if not exist on DB?
I'm not really sure with number 4.. and are my steps are correct?
Thanks
Just follow the tutorial step by step, this will teach you how to create and build your project in a very simple way.
Getting started with ASP.NET Identity:
https://www.captechconsulting.com/blogs/Customizing-the-ASPNET-Identity-Data-Model-with-the-Entity-Framework-Fluent-API--Part-1
and here is a good Introduction to ASP.NET Identity:
http://tektutorialshub.com/asp-net-identity-tutorial-basics/

Deployment of ASP.NET MVC 4 web application with Entity Framework Code First approach

I want to make incremental releases of a web application implemented in ASP.NET using MVC 4 and Entity Framework Code-First.
I want to make a good and safe deployment routine. I currently use Subversion as source control, and plan to make releasable tags available on the SVN server, to deploy on the production server. The server runs on a separate network, but has access to the SVN server.
The server runs both IIS and MSSQL server.
What is the best way to deploy new releases to the production server using SVN? Prebuilt binaries or build on site.
How to handle model changes on the production server? On development I use Update-Database function on the Package Manager Consol in Visual Studio.
EDIT:
I will try to base my setup on this blog post, which uses git instead of SVN: http://www.jayway.com/2012/10/17/a-simple-continuous-integration-and-deployment-workflow-with-asp-net-mvc-github-and-jenkins/
But still all suggestions are very welcome.

Deploying Devart EF Odata app to a Server - cannot find Framework Data Provider

I followed the simple tutorial # http://www.devart.com/dotconnect/oracle/articles/Tutorial_EF.html
(Which works perfectly, btw) combined with http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx for the OData part and now I need to deploy it to a server.
The problem I am having is that in step 4 of the devart tutorial, I chose a "Data Connection" to my database. Everything works fine on my dev box, but when I published the EF project, there was no reference to the DevArt dlls in the project. So, none were moved to the server.
And, of course this is producing a 'Unable to find the requested .Net Framework Data Provider. It may not be installed.'.
I tried just copying the dlls into the bin directory and I installed the devart product on the server. Neither worked.
I am used to ASP.Net applications that reference the needed Data dlls. What do I need to do to get my EF Odata service running?
The following page will explain how to deploy your EF devart project:
DevArt - Deployment

Template ASP.NET MVC2 Web Application

I’m new to MVC and am trying to set-up a basic template application. From VS2010 I’m creating the template MVC2 project. However, I’ve noticed that the database is sometime not created as part of the template. Are there any rules to when or where this creates its own database, or why it might not do so?
The standard MVC template has a connectionstring in the web.config pointing to a aspnetdb.mdf database in the App_Data folder.
The default MVC 2 Web Application template uses the database for authentication (through the AccountController).
The physical file gets created on first use; probably when you register an account or attempt a logon while running the application.