Base solution for your next web application
Open Closed

Connecting to another database (not using entity framework), best practices #11157


User avatar
0
Kaarlaid created

Prerequisites

  • What is your product version? 11.2
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET CORE

I have a requirement to connect, within ASPNetZero, to another database at the same time to provide API access to legacy data (in this case I am using Developer Express's XPO), but still with access determined by ASPNetZero rules. However, I cannot work out within which of the layers of the ASPNetZero architecture I should be doing this. I am wondering if you have a 'best practice' recommendation for this case (which could well be the same as connecting to two database at the same time utilising EF)? And also at which level the APIs should be implemented?


2 Answer(s)
  • User Avatar
    1
    marble68 created

    For what it's worth - we accomplished this by adding a project to the solution and referencing as necessary.

    Depending on where / how you will want legacy data access, you can approach this by either adding references whereever you need this legacy data, or - create a service for it and reference it only there.

    For example - You create a new project that connects to your legacy data. Then, you reference that in the .Core project. In the .Core project, you wrap the legacy data access with a service.

    Your new legacy data service could then be exposed throughtout the architecture

  • User Avatar
    0
    Kaarlaid created

    I had read your reply a while back, but - thank you - the advice is appreciated. We are not so experienced with ASPNetZero, but this seems like a good approach that we will keep in mind.