Shared Sqlite Between Webapplication Projects - c#

I'm working on TO-DO management solution which has two separate asp.net mvc core web applications and one web api application as;
- Admin panel web app. ( Doing CRUD operations on Todo list )
- Front office web app. ( it will list todo items )
- Webapi web app. ( Also it will list todo items )
How to share one Sqlite db file between those projects ?
I need to give some full path of the Sqlite file in solution so every application should look this path/db. Also I'm using entity framework core, so solution has entity-migrations as well.
I don't want to use MsSql, MySQL, MongoDB etc. Please don't suggest them as a solution. I know "MVC framework Areas" feature. And I know I can host Webapi and Web app on same project but i don't want to combine these projects. Samba share, windows file share is not an option as well. I will use shared hosting as well so I can't use "/var/local/share/app.db" or "D:\app.db" or a temp path etc. So how can I solve this problem?
I'm using Ubuntu OS. Entity freamwork core, All projects uses Asp.net Mvc Core 2.1, C#

Related

NX monorepo in a dotnet Angular project

I am doing some research for a new project. This project will use .NET/C# for the backend and now I am investigating about the best way to integrate the frontend in the same repository.
There will be multiple client apps like a web based CMS and Android/iOS mobile apps. Because of the team expertise NX, Angular and Ionic has been chosen as client technologies.
I know dotnet has a template to create an Angular SPA project, since there will be multiple client apps and we want to share code between them I wanted to convert it in an NX monorepo but beside this article (not working for me) I didn't find how to do it. I came across nx-dotnet but wraps a C# backend inside a native NX monorepo (I am trying to do the opposite: NX in a dotnet project).
Is there any tool or docs about converting the dotnet Angular template in a monorepo? What is a good practice to share code between multiple client apps in a dotnet solution?
I thought about the following alternatives:
Init the NX monorepo in a folder and treat it like a normal node app (not a dotnet project)
Use Angular Workspace feature

Sharing code between ASP.NET MVC 5, ASP.NET Web Api 2 and Mobile (Xamarin)

I'm an experienced ASP.NET MVC and Web Api 2 Developer and now our company is starting on mobile development.
Our projects use .net framework 4.7.2.
We have a "common library" that all our projects reference.
Also, we have a POCO class project, which, of course, contains only poco classes (we use entity framework 6)
So, what we need is to use that "common library" and the POCO classes with the mobile software, while using them on existing projects, like the ASP.NET MVC 5 project.
What is necessary to accomplish it, considering we do not want to "duplicate" code?
Thank you very much!
You can use Shared Projects.
Here is a complete walkthrough how to achieve that (the tutorial is long so I won't post any steps).
With this, you can reference the models in other projects, and keep the always updated.

Is it possible to run multiple ASP.NET Core projects in single applications?

Consider I'm having two ASP.NET Core MVC Web projects.
Project A - will have accounts and user information. (Not a class library)
Project B - will get account information from project A
Project A can be run individually.
Project B & A can be combined and run as single application
Is it possible to handle this in ASP.NET Core? If yes, what is the beast approach?
Like this (This is a ASP.NET MVC app)

MVC4 and MVC5 in one solution

I have an odd question. Can we have a solution comprising of both MVC4 and MVC5 projects?
The scenario is that there is a common project which is on MVC4 and being used by many other applications, but now we want to create a project in MVC5 or convert the existing template to MVC5, but also want to include that MVC4 project in the new solution.
Will that work? Will the new MVC5 project be able to work with old MVC4 projects in one solution?
I was following the guideline of conversion but it says to run the upgrade-package command and this command updates all packages in the MVC4 project as well, which we don't want to do.
Both projects are targeting .NET Framework 4.5 and using Visual Studio 2015.
A solution is just a collection of projects; there's no restriction they they use the same frameworks or dependencies, so it should be fine to have them both in one solution.
You probably cannot, however, deploy them to the same web application. They will likely need to be isolated to different applications in IIS or wherever you deploy them.
If you have dependencies between the MVC apps you will likely have problems. I would recommend moving as much logic that is not critical to the MVC app (classes, business logic, repositories, etc) out of the MVC apps into a common library that is independent of the app that uses it.

Do I need .net framework 4 and MVC 4 installed on hosting server to deploy MVC 4 app?

We have created a solution in MVC 4, targeting .Net framework 4. On local IIS it runs like honey. But recently I Published it and copied all my data including Bin folder ( which includes dll dependencies of my project) to hosting server. But whenever I am trying to visit my domain
www.myexampledomain.com/
It returns nothing. But an error. that
Viewbag is not available in current context
Why M I getting this error. I found ASP.NET Versions 1 & 2 on my hosting account. Do I need to install .Net framework on server, if yes do I need to install MVC 4 too?
no need of MVC 4 to be install just install .net framework
MVC 4 is for developing application in MVC pattern and .net framework is for provide runtime environment
After searching a lot and after reading comments n 5-10 trails , I found I made a small mistake by not setting CopyToLocal property of every MVC referenced DLL to true. It took me 2 days to resolve.
If you have same issue. kindly check on this solution too. It might help you!

Categories