Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Has anyone written a ASP.NET Core Web API targeting SQL Anywhere? I suspect this is problematic because the ConfigureServices method in the Startup class needs to set up a DbContext, which is an Entity Framework Core object, and SQL Anywhere does not have an Entity Framework Core provider. I don't see a generic ODBC EF Core provider.

Does anyone have success using System.Data.Odbc instead of Entity Framework Core in an ASP.NET Core Web API?

I would really enjoy seeing a "Startup.cs" file from such a .NET project.

Any guidance on how to proceed would be appreciated.

asked 08 Dec '20, 13:31

dharrel's gravatar image

accept rate: 0%

For .Net Core you can not use Entity Framework at all with SQL Anywhere. You can only use a plain ODBC connection.

permanent link

answered 09 Dec '20, 07:59

beater's gravatar image

accept rate: 0%

Thanks. I'd really like to see an example of what you would encode for "services.AddDataContext..." when using a plain ODBC connection.

(09 Dec '20, 16:11) dharrel

there is none. you can't do that at all. That is an Entity Framework concept.

(10 Dec '20, 05:52) beater

Thanks, again. Can you suggest an alternative with "plain ODBC"? Is it at all possible to create a ASP.NET Core Web API that uses "plain ODBC" to work with a SQL Anywhere database? I know we can do this using Appeon frameworks, and we are doing so, but I'm interested to know whether there is a "pure Microsoft" approach.

(10 Dec '20, 13:17) dharrel

the same way you would have done anything with SQL Anywhere and C# before Entity Framework came along.

(11 Dec '20, 07:48) beater

Very good. Thanks. I'm new to this technology, so I haven't done this before EF came along. However I'll cross that bridge if I get to it.

(11 Dec '20, 14:45) dharrel
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Dec '20, 13:31

question was seen: 1,552 times

last updated: 11 Dec '20, 14:45