Maro
Maro

Reputation: 2629

Multiple solutions application

I'm planning to create a website using ASP.NET Core 2.0 , Entity Framework Core, Angular.

I was planning to create one solution with different projects (core, data layer, UI ...etc ) however the client quoted "this is a bad idea, please create separate solution for your UI and API).

how can i create multiple solution and still let them interact with each others? What is the best practice? If i create separate solution for my UI, how can i communicate with EF context which is in a different solution?

Upvotes: 1

Views: 3325

Answers (4)

Mahadevan Annamalai
Mahadevan Annamalai

Reputation: 146

how can i create multiple solution and still let them interact with each others? What is the best practice? If i create separate solution for my UI, how can i communicate with EF context which is in a different solution?

Answer :

  1. Create base solution first ex : BaseSolution.sln then go to that solution file explorer and create API,UI folder.
  2. Now open visual studio and create new solution ex: ApiSolution.sln save it under API folder and add web api project inside ApiSolution.sln and save.
  3. Now open BaseSolution.sln and right-clicking the solution in Solution Explorer and choosing Add - Existing Project then choose web api project from ApiSolution.sln then add it. You can follow step 2 and 3 to create more solution and add it to BaseSolution. Web api connect through HTTPClient with another web api.

Upvotes: 0

Pazgabear
Pazgabear

Reputation: 103

I think your client may misunderstand what a solution is. Grouping your projects in a solution only affects your workspace in Visual Studio, it does not mean that your projects have dependencies between them (unless you explicitely say so in their references)

Upvotes: 2

Martin Zikmund
Martin Zikmund

Reputation: 39082

Solution is basically just a logical container for projects, so you can create multiple solutions which will reference the same (existing) projects. This is quite common for large solutions like for example Xamarin.Forms - you can have one large solution with all projects and then have smaller solutions for developers who need to work with only a subset of the projects.

You can add existing project to your solution by right-clicking the solution in Solution Explorer and choosing Add - Existing Project.

Upvotes: 2

Mike Hofer
Mike Hofer

Reputation: 17022

The only way I can imagine this working is to deliver each solution as a set of microservices.

However, now your architecture is different. Only one of those solutions is going to be publicly exposed. The others will need to sit behind a firewall to ensure that they can't be reached by external users. But all of them will have scalability and security concerns.

So you'll have a set of data services that encapsulate Entity Framework and expose the data through a Web API, and a business logic API that is reached over a Web API, and then your UI (which should include Angular).

APIs calling APIs. Welcome to microservices.

Upvotes: 0

Related Questions