Design asp.net web application as two separate modules for separate deployment - asp.net

I'm working on a web application that consists of two separate modules. I've finished working on module 1 of the application and right now I'm starting to work on module 2. I need to find a way that allows me to deploy the two modules separately at the customer.
For example, when doing changes to module 1 I would deploy module 1 only, when adding new features in module 2 I would deploy module 2 only.
I currently have a single project in my application which includes module 1:
should I create a new project for module 2? If so, I'm not sure how I can create a link between them, as I will need to navigate from Module 1 to Module 2 using an aspx page or so.
If I let them be in the same project, would that be a good design practice? Also Is there a way to still separate between the deploys?

Related

Tomcat or JBoss hosting 1 webapp with multiple websites

I want to have 3 websites, all with distinct public domain names but they all share a common java back-end SpringMVC server and use common static web resources like js and css files.
Rather than maintaining the UI code in 3 places, I'd rather run 1 server and deploy 1 WAR on a Tomcat8, Jboss or Wildfly cloud instance like OpenShift or AWS, but still be able configure my dns CNAME's to point to different paths on that WAR.
For example, here is where each domain would map to their respective endpoints but not have visibility of the others:
www.mydomainA.com ---> mycloudprovider.ip/sharedcontext/A
www.mydomainB.com ---> mycloudprovider.ip/sharedcontext/B
www.mydomainC.com ---> mycloudprovider.ip/sharedcontext/C
Is this possible? If so, what would be the steps to configure?
It is actually beneficial to configure 3 separate projects. They will all need to have their own application contexts, but can share a single parent POM. This will result in better load balancing performance. Also, since Amazon's pricing structure is such that it is cheaper to set up 3 micro instances than one powerful instance to run all 3 wars. Note: You can still have all 3 instances pointing to the same dataSource.
To solve the problem of duplicate webapp code, you can create a pom overlay using the maven-war-plugin. When Maven applies the overlay it will essentially apply a union of the files from your app with the files from the overlay. Any files that intersect will be used from the app rather than the overlay.
To solve the problem of duplicate java code, you can separate the common code into a new project and build a jar to use as a dependency.

How to reference code in website

My code is divided into websites, one for each module (in TFS). Also, I have some application level code (like loginpage.aspx, webconfig.xml, Configuration.xml, Common.css, Logo.gif, masterpage.js, mainmaster.master, mainmaster.master.cs, etc) which is common for all module level websites. Is there a way I can reference the common application level files in each module level website. I want to avoid multiple copies of the application level code, by using a reference or some other mechanism.
The best way to handle this kind of shared code is in your solution-structure, so TFS can stay straightforward and your common code is not duplicated localy either.
So try to make the common-code shared by creating a project that provide baseclasses where the other projcets (the websites) can build on.

What are Modules in a project?

Hi i want to know what is meant by modules in a project??how they are classified and how many modules we can have in a project?can anyone explain with simple examples??What modules we can have in a typical online shopping website?
In .net context I believe one can draw 2 meanings not sure what specific you are looking for.
One is modular programming by following design principles like "Separation of concerns", "Single Responsibility", "loose coupling". This means divide you code into classes based on these principles and further group these classes again based on these principles into modules.
In ASP.NET or C# or in general we create class library projects and use them across the entire project. Like all the logging functionality is put in some classes and these classes are include in an class library project which can be called "Logging module". Whenever you need logging in any of the project you can include this module and use the functionality.
Some examples:
Web module for HTTP requests ( The WebApp)
Repository and Data access Layer modules. (DAL code)
Models module containing all the business entities.
WebService modules for integrating with other apps.
Logging for debugging and problem identification
Infrastructure/Utility modules for utility like functionalities and
application configuration.
Business logic modules.
Transaction gateway module.
Other way to define module in .net is they are PE files and I believe they have extension .netmodule which contain Metadata but they do not contain the assembly manifest. To use a module you have to create a PE file with the necessary assembly manifest.
Create a module:
csc /t:module ufo.cs
Create assembly using the module:
csc /t:library /addmodule:ufo.netmodule /out:airvehicles.dll helicopter.cs
Above 2 commands are from this link
The module is an external code that you plugin on your site and runs in order to do some actions.
(source: codeguru.com)
We make and use modules to have the ability to share the actions of the module with others with out giving the source code, and vice versa, we use modules from other that we do not have access to the source code. Or we can simple use module for have the ability so simplify our code and remove it easy if we do not need it.
We can have as modules as we like, but each module place extra overhead on our code - after all is need to make more thinks there.
More about modules: http://www.codeguru.com/csharp/.net/net_asp/article.php/c19389/HTTP-Handlers-and-HTTP-Modules-in-ASPNET.htm
How to create module: http://support.microsoft.com/kb/307996

Sharing code between Flex and AIR

As you know, we could build a RIA application based on flex. Also, we could build an desktop application based on AIR. I have a question, If we want to build web & desktop application simultaneously. Could we use the same codes to ship our production to web & desktop?
If you design your application for it, you should have no problems in sharing 99% of your codebase between your Flex and AIR builds.
You will need a separate application MXML for the Flex / AIR versions as AIR uses a WindowedApplication and Flex uses Application
You will need to abstract your usage of any AIR-only APIs. That is, any class, property or method marked with the AIR-only icon (
) in the Online Documentation. You might find this process easier if you are using a Dependency Injection container like Swift Suspenders.
Alternatively, you can split your service definitions into two different source trees. This would result in your AIR project and Flex project sharing one source path, but also having their own source path. This way, code that accesses com.application.MyService would be shared across AIR and Flex but the implementation of com.application.MyService would differ depending on which 'service source path' was being used.
You may find it useful to configure each build with a compiler flag like -define+=CONFIG::AIR. This allows you to use conditional compilation so that you can compile the same file for both builds, but include specific code for the AIR build.
Here is an exmaple of conditional compilation:
public function getMyService() : IMyService
{
CONIFG::AIR
{
return new MyServiceThatUsesAnAIROnlyAPI();
}
return new FallbackServiceForFlex();
}
Unfortunately there is no way to 'negate' a conditional flag (ie. !CONFIG::AIR) so you either need to be smart about your usage of it, or include two flags (CONFIG::AIR and CONFIG::FLEX)
I'm surprised no one said it yet, but this is how I would do it:
Create a library project. this project will include all your
shared code.
Create a Flex project for web deployment
Create an AIR Project for AIR deployment
Both the Flex and AIR projects can reference and use code in the library project. The AIR project can use AIR specific functionality without affecting the web project.
If you need to perform different actions differently based on whether using the web project or the AIR project, you can create interfaces in the library project and implement them in the main project to use the respective APIs.
yes, you can do it.
there are some conditions you have to control in code.
Keep in mind, if the application is also a flex app, then it will be a single window app.
for every project I make needing this I create 3 projects
code base (the main control is a group or a canvas)
flex exporter => when you build this you will end up with a flex application
it has a control from #1 inside the main application
air exporter => when you build this you will end up with an Air app
it has a control from #1 inside the main window.

MSI for multiple websites WITHOUT custom actions

I would like to create an installer that installs 6 websites, all of which rely on a data access library. So the solution contains 6 web applications, and 1 class library.
Question is: how can I accomplish this without using custom actions?
So far, the only thing I've thought of is to make merge modules out of the web app projects, each of them throwing in the primary output of the class library project, and then making a main installer that has all the merge modules.
I would put each website in a feature that way you could give the end user the control over which website they require, if that is an option.
Although, you'll have to repeat the same type of code for each website in their respective.wxs file.

Resources