简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM