Has anyone used .NET Core EF with Caché?

What would a sample DbContext look like and how would you register the DbContext in the Startup.cs  ConfigureServices method?

  • + 1
  • 0
  • 94
  • 3
  • 1

Answers

I haven't tried this, but Microsoft's DbContext doc here:

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

seems to match our example down this page in our docs here:

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

I don't find ConfigureServices in our docs, but Microsoft indicates that it is optional:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/startup?view=a...

Sorry for lack of detail.

. They are two different platforms and is most likely why you could not find ConfigureServices in the Intersystems docs.  For a Micosoft SQL Server, your ConfigureServices method could have

            services.AddDbContext<MyMSDBContext>(cfg =>
            {

                cfg.UseSqlServer(_config.GetConnectionString("MyConnectionString"));
            });

but I haven't seen any examples in Caché! Perhaps there is a development opportuntiy to write a NuGet package? Here's a Microsoft link to other popular database providers supported within .NET Core.

PS. If you use RESTful HTTP methods to talk to the database then you don't need a database provider as the data can be returned as part of the HTTP Response.

Comments