I have seen an example showing the entering of "seed data" when building an ASP.NET Core Razor app...but how can I incorporate an entire pre-existing database into a new ASP.Net Core Razor app. The database(an accdb) would be coming from a WPF/C# app with
data spanning several years.
have seen an example showing the entering of "seed data" when building an ASP.NET Core Razor app...but how can I incorporate an entire pre-existing database into a new ASP.Net Core Razor app. The database(an accdb) would be coming from a WPF/C# app with data
spanning several years.
Pretty simple. Add a connection string and a data provider. Is accdb an MS Access DB?
None
0 Points
10 Posts
Incorporating pre-existing database into new ASP.NET Core Razor app
Jul 28, 2020 12:14 PM|irsharp23|LINK
I have seen an example showing the entering of "seed data" when building an ASP.NET Core Razor app...but how can I incorporate an entire pre-existing database into a new ASP.Net Core Razor app. The database(an accdb) would be coming from a WPF/C# app with data spanning several years.
Thanks!
All-Star
52971 Points
23574 Posts
Re: Incorporating pre-existing database into new ASP.NET Core Razor app
Jul 28, 2020 12:21 PM|mgebhard|LINK
Pretty simple. Add a connection string and a data provider. Is accdb an MS Access DB?
None
0 Points
10 Posts
Re: Incorporating pre-existing database into new ASP.NET Core Razor app
Jul 28, 2020 12:45 PM|irsharp23|LINK
Yes. Thanks!
Where to put the connection string in the code is something I'll need to work on...but thanks for the info.
All-Star
52971 Points
23574 Posts
Re: Incorporating pre-existing database into new ASP.NET Core Razor app
Jul 28, 2020 12:52 PM|mgebhard|LINK
I'm not sure if there is an MS Access data provider that will work in Core 3.x. You might have to drop to 2.0.
Edit: connection string go in the appsettings.json file.
Member
30 Points
32 Posts
Re: Incorporating pre-existing database into new ASP.NET Core Razor app
Jul 28, 2020 01:04 PM|vsetia|LINK
You can scaffold Db Context:
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Reference:
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell#scaffold-dbcontext
Please let me know if this doesn't help :)