ASP.NET MVC 5 Modular Web application Architecture? [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
The company where I am currently employed is struggling with an architectural decision for our range of applications. At the moment we have a couple applications that have common parts (think like a calendar module). Until now we kept on copying code from other existing application, but in the future we want to evolve our applications to a more modular design:
As you can see in the picture above it is possible to have different versions of modules per application.
We are considering to possible solutions:
Building a core application framework where we can install our
modules in. We're think about a tool like Nuget to accomplish this.
Building one application where all our modules are included in (=one code base), but the customer only gets the functionality that is activated for him. We're forseeing some problems with versioning here.
Any suggestions on this? We can't be the first company who struggles with this problem?All our applications are ASP.NET MVC 4/5 web applications, built with Razor Templates or JavaScript templates (knockout.js). All of our applications are deployed on Microsoft Azure and we have extensive inhouse knowledge of buildscripts (MSBuild), CI Servers...

Having separate project/assembly for each module and delivering it as Nuget package is definitely a good strategy.
Advantage:
Can maintain and release multiple version. Different client get different version.
Installation of latest or specific version supported through Nuget. This helps during development where App A developer can target 2.0 version of module A while App B developer can target 1.0.
Single source base with separate branches for each version. Client using 1.0 request a change will get code from branch 1.0 with just the fix requested.
Each module can be released or updated independently.
Challenges:
During development debugging assembly code that's installed using Nuget. Nuget supports it inbuilt. We achieved it in our case (Framework being used by multiple platform).
Code changes required in module code (a bug or a new feature required). Well this is tricky:
Option 1: Same developer just go ahead and make that change, create new package and install new version in his app. Got to authorize the change as it is critical code.
Option 2: A designated team responsible to fix issue or change request in framework code.

You can also try using the plugin architecture, just build the different modules that makes up the application as a plugin, then build the module that is required for every application as a single code base. In this case, installing a component for any particular user, will be a matter of adding or pulling out plugins. Many large projects makes you of this particular architecture as it reduces copy and paste, increases and reuse and speed of development. You can check nopcommerce an open source project for an idea of how it is done.

Related

How to setup a solution with two Web API Projects? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm in charge of porting a Java application to .Net platform.
I'm kinda experienced with C# and .Net but I've never started building things like this from scratch.
So, this application consists of two parts:
Framework: A small framework responsible for creating CRUD pages endpoints. This framework uses classes from the "business layer" as models in order to easy build pages. It basically has a FrameworkPage<T> class and we use a type T and some overridings in order to write it. Also, this framework has some endpoints of its own. Like myapp/framework/FirstPage which maps to a framework/{pageName} controller where we use a generic logic to retrieve data for that page. The important part is that this framework has its own endpoints.
Business Layer: Application that uses the above framework, has its business classes and also has its own custom endpoints for pages that are not the default framework page.
Today, in the Java project, these two are only separated in different folders. In the future we want to reuse the framework wherever we want, so it is important to keep it dettached from any business logic. To do so, in .Net platform, I think it would be interesting to have these two in separated projects inside my solution. Then, in the future would be easy to separate it and even compile it into a dll to use in another projects.
Is this the right approach? If so, how can I make it possible since I'm having two web apis applications? As far as I know about a .Net project configuration, I have only one startup project (the one that is deployed). I can set a multiple startup configuration on those guys but I could only get them to be started as separated apps: localhost:XXXX/myapp and localhost:YYYY/framework. I need the framework to go "inside" the application: localhost:XXX/myapp/framework/framework-endpoint.
Thanks!
Found one solution that suits me by using AddApplicationPart().
Basically, on the Startup.cs of my BusinessLayerProject I configure the services as:
using Framework.Controllers;
// ....
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddApplicationPart(typeof(FrameworkController1).Assembly)
.AddApplicationPart(typeof(FrameworkController2).Assembly)
// ...
.AddControllersAsServices();
With this, if my framework controller has a route like framework/controller1 I can access it when I deploy the BusinessLayerProject

Migrating from ASP.NET 4 to .NET CORE 1.1 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working on migrating from ASP.NET 4/Webforms to ASP.NET Core/MVC. I'm new to MVC, but understand the concept. I have, however, ran into one issue with getting the handle on ASP.NET Core. I have several questions.
With my legacy (ASPNET4) projects, I wrote a "helper" library that provides basic functions for my web projects:
- Database Handling (connection, cleanup, error catching, caching, paging, binding, etc)
Misc functions (viewstate compression, date/time functions, etc)
Storage management (Sessions, cookies, etc)
Plugins (twitter, facebook, google integrations)
Identity Management (custom identity that works with other systems)
I think you get the point...
Over the years, I have developed this framework while constantly updating and bug fixing. It has become very fast and stable - it even handles any database you want to throw at it!
While researching, I found that .NET Core makes it hard for me to accomplish the same tasks. First off, it seems like CORE only supports object relational mappers (entity, dapper, etc). I'm perfectly content with ADO.NET, and understand the differences. I just really don't want to use the Entity Framework, or Dapper. I can migrate most of my code from .NET Framework. But it looks like ADO.NET isn't fully supported in .NET Core. Is this the case?
My next issue comes along after database support. I'm finding it incredibility difficult to manage things like sessions/cookies/etc from a class library. Perhaps I am misunderstanding the concepts, or not finding the proper documentation, but it appears as if it is nearly impossible to manage Session/Cache/etc in an external library. Is this the case? Or do I need to research creating custom middleware?
Basically, I need full access to the website from a library so I can use my own code to handle things like Sessions, data management, etc.
Is MVC the only option available for ASP.NET?
Finally, it seems like Visual Studio 2015 is very glitchy and slow with handling .NET Core applications. This has been a major turn off for me, everything from the interface to NuGet seems slow and glitchy.
Any recommendations or suggestions on where I should go or start with .NET core is greatly appreciated, I've spent weeks reading documentation and experimenting but have made no real progress. I really want to move away from webforms!
Next Tuesday (3/7/17) Visual Studio 2017 will release, which has fully integrated support for .NET Core. VS15 has the preview tooling right now, which causes a lot of the glitches you are experiencing. You might also want to consider converting over to the VS17 RC right now if you are early on in the process, as .NET Core 1.1 is much more friendly than 1.0.1 (in my opinion, since there is no project.json).
As for the database interactions, the idea behind Entity Framework is that it is a drastic improvement over having a DAL or another database service layer on top of your program. Through EF Core's Middleware/DbContext all database interactions can be completed with raw SQL or LINQ (or both). With this interaction, there isn't really a need to have the DAL/ADO layer.
Entity Framework is built on ADO.NET, and is a drastic improvement over other entity relationship libraries. See mason's comment below on ADO.NET on wikipedia for a better look at this.
As for the cookies/sessions, I'm not terribly experienced with this kind of information, but the one thing you might want to look into is the ASP.NET Identity for user information and sessions. IdentityServer 4 is another option.

Why should I create setup project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
When I am creating projects in VS I only add a set up project to my solution if it is a service (I can't get it running without installing it first).
If the prorgam isn't a service I don't normally create a set up project but rather copy the .exe file as well as all the necessary dlls for the application to run to a desired folder and I run the application from there.
My question is if there is any benefit in terms of performance or anything else when you install a program (through its set up) rather than just running it without having it first installed it
It highly depends on needs of your application. You may for instance:
Add necessary registry entries
Register file extensions to your application
Check prerequisites and (potentially) install missing libraries or frameworks
Check for potential problems, which will disallow your application to work correctly
Allow user to choose only subset of features your application offers (thus making the installation smaller)
Choose binary and library files for specific environment (for example 32 vs 64-bit). For example, NVidia now gives you one unified installer for a series of graphics cards and then installer chooses the appropriate ones to install.
Automatically add shortcuts to start menu/screen and desktop
You can of course embed most of these actions in your application, but I'd vote against that. That's because your application would have some boilerplate code, which would run only once, or even your application might not start because of missing requirements, which setup application might have resolved.
Also, it's less user friendly. With setup program, users may very quickly prepare application to work and also - equally quickly - remove the program from their computer (along with all config files, registry entries etc.).
If you plan to use the program only by yourself, it's your choice. But if you want to publish your program, I'd suggest at least making an option to either install program or use it in the portable mode (without installation).
I think there are benefits of having setup project from end-user and developer perspective as well. Normally when you finish your project you want to easily distribute it. End users are rather used to downloading and installing application in a common way meaning:
selecting the destination path
select whether to install for all or only current user
checking whether to create desktop/programs menu icons or not
lunch the program after installation
and this can be easily accomplished by setup project.
I think regular user finds hard to let's say
download compressed file
extract package (assuming that appropriate for doing it is already
installed. In other case it is required to install it)
create dektop shortcut

Embedded C# web server? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
In Java I've been able to embed* the jetty server in my apps, but is there an equivalent embedded* server technology for .Net?
Open source (FLOSS) would be preferred if possible.
*by embedded I mean a lightweight web server app that could be packaged with my application and run on a user's local desktop machine to provide a web service locally.
The closest equivalent to Jetty I've found so far is Nancy, described as:
a lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono.
Nancy is designed to handle DELETE, GET, HEAD, OPTIONS, POST, PUT and PATCH requests
Nancy was designed to not have any dependencies on existing frameworks. Built with the .NET framework client profile, Nancy can be used pretty much wherever you want to, since it’s completely self contained with it’s own request and response objects.
One of the core concepts in Nancy is hosts. A host acts as an adaptor for a hosting environment and Nancy, thus enabling Nancy to run on existing technologies such as ASP.NET, WCF and OWIN, or integrated in any given application.
An even more lightweight option is Kayak (Update: project looks dead as of 2014-01-18), which its documentation describes as:
a simple web server. It listens for connections, creates an in-memory representation of requests, and allows you to easily generate responses. It can be used in any C# program. Your code loads Kayak into its process space—not the other way around!
and both Nancy and Kayak are MIT licensed.
Here's another alternative I wrote last year and and has served me well.
EmbedIO: https://github.com/unosquare/embedio
I use it mostly to create RESTful services on the Raspberry Pi (soft-float).
Edit: Updated code for Mono 3.10, support for WebSockets, and Asynchronous handling of requests.
Update for 2016:
The new kid on the block is Kestrel.
Kestrel is an open source web server that is a part of the ASP NET Core initiative by Microsoft. It is an event based webserver built upon libuv (it basically node.js - js + .net). This means that it should be easily portable between different operating system. Unfortunately, it does mean it requires an external native dependency. *
https://github.com/aspnet/KestrelHttpServer
An older project that does this is Nowin
https://github.com/Bobris/Nowin/tree/master/Nowin
This is an implementation of Owin built entirely within .net. Unfortunately, it has been deprecated in favor for Kestrel.
Edit: * The newest version of Kestrel has dropped libuv for a managed dotnet socket approach. This of course means Kestrel no longer has a native dependency.
The one that is used with Visual Studio is called cassini. There is a good derivative called UltiCassini.
The solution from Microsoft itself is called Katana,
https://katanaproject.codeplex.com/
Note that it is fully open sourced, under Apache license.

How do small programming teams work in C# .NET? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
What tools/plugins do you use for checking in/out code?
how to communicate changes made to the code, how to make request for new functionality?
How has your team solved this?
See this previously asked question:
Multiple Programmers in Software Development. How do we work on the same code and ensure it is always updated?
There are a lot of good answers to this question, and they apply to small and large teams.
For source control, we use Svn with the Tortoise SVN client. We've used other source control systems in the past, and have found this one to be the best for our needs.
I would recommend you use SVN for source code management, if you are using visual studio you can get numerous plugins for IDE integration.
http://subversion.tigris.org/
http://www.visualsvn.com/ = SVN Server & VS Integration
Try to set up Continuous Integration for this you can use Cruise Control .Net or Hudson. Cruise control can be set up to do a build on each check in and the history is shown on a web page.
http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET
http://hudson-ci.org/
For requesting new functionality you could use a ticketsing system, wiki or Google Wave any one of these should enable you to keep track of requirements.
Hope this helps.
You can pretty much use any tools for small development teams you wish. There are lots of options.
Personally, my team uses SVN for code, and Trac for tracking - mostly because it's very cost effective for a small team. However, there's nothing C#/.NET specific about that setup.
If your team has MSDN subscriptions, you might want to consider Team Foundation Server. It has many features for integration with Visual Studio that are (arguably) superior to some of the alternatives.
You should use one of the many available source control repositories. Trust me, you won't know what you did without it :)
There are plugins for Visual Studio for working on a team, but personally I've never used them.
I've done team projects with both Subversion and Mercurial... just make sure to check in the solution and project files, and all related code.
Everyone will also need to be running the same version of Visual Studio.
For requesting new functionality, you might want to consider an external solution like Trac or Bitbucket or some other free system that includes issue tracking.
Well, how small? I work on a team of 5, and we communicate well with IM, or just dropping by and talking. That being said, the team is pretty responsible, so you can trust everyone to carry their weight. I would suggest you use subversion for source control if your company doesn't have anything.
We're a team of 3 C# developers.
For version control, we use AnkhSVN, an open source SVN client that integrates with Visual Studio.
For project management, issue tracking and feature requests, we use Redmine.
What tools/plugins do you use for checking in/out code?
Mercurial -- once you've used a DVCS, it's hard to imagine going back. Everybody uses their own favorite editor; usually, that's Emacs, which comes with support for many VCSs, including Mercurial.
how to communicate changes made to the code, how to make request for new functionality?
Changes are tracked in version control. You can look at the changesets as you pull them, or browse the web interface. Or just ask people at lunch what you're working on -- no developer is an island. New functionality is tracked, along with bugs, in the bug tracker.
How has your team solved this?
We're a small team using C#, but nothing here is specific to C# or small teams. I've used very similar systems with other size teams, and other languages/platforms.
We have a team of three and currently use Source Gear Vault for source control and Fogbugz for bug/feature tracking. Source Gear integrates into Visual Studio nicely and works over http which makes it easy to access from anywhere. Check ins and outs can be done directly in Visual Studio or a standalone client.
Source Gear also integrates with Fogbugz.
Used to use Visual Source safe and would never go back...
I work on a small team of 1-5, depending on the project.
What tools/plugins do you use for checking in/out code?
We use Git with Github for new projects, and TFS for some legacy work.
I see a lot of people recommending a certain provider without telling you why. I have used TFS, SourceGear, SVN (a little), and Git. I prefer Git because it stays out of my way. Git is command-line based. My typical source control workflow is a handful of simple commands, but learning those commands took a few tries.
how to communicate changes made to the code, how to make request for new functionality?
We use Pivotal Tracker for story writing and organizing priority.

Categories

Resources