I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use a common codebase to support different websites. These websites would differ in following aspects:
Each website will have their own headers, footers, images, CSS etc (I guess website specific Master Pages)
Some of the UI elements could be different based on soft-coded settings at website level
What is the best approach to handle these requirements? Should I be storing these website level soft-coded settings in Database or multiple config files? I might have to provide a admin UI to manage these soft-coded settings. How do I access these settings in different layers (MVC, Services, Repositories etc) of my application?
I need suggestions from experts.
Regards,
Alex.
Develop some sort of Presentation Object Model (or possibly Aggregate if you're DDD inclined) and then persist that to the db. It could be per-user or per-site (if it's a multi-tenanted app you're building) and with MVC it would be easy to build Html Helpers that accept these Presentation Model Objects and render out your customized header, css, images etc.
Potential long-shot practical example:
Let's say your 'tenant' is called a Site - you'll prob have a Site object in your model. A property of Site could be a WebPresentation object. WebPresentation may have a series of child objects and lists with methods for reading css, css files (for <link> elements in the document head), images, etc. You may also have a Service or set of Service functions for persisting/validating the WebPresentation objects (or you may try to have this functionality come off the objects themselves- think .Save()). I won't go into how you persist this data to the db (don't want to insult you). As for the Views, you would design them (perhaps Partial Views) such that the custom WebPresentation Html helpers render the customizations out into the views or <head> sections of your MasterPages.
I hope this example is useful.
Related
My angular application consist of 2 parts based on public and private pages:
1- Landing Page (Before Login)
2- Dashbaord and other Pages (For Authorized User)
Landing page component contain signup/login functionality and some other static html elements.
Both are seprate components and have different stylings. I have already mentioned landing page's styling in it's own style file.
After login user can access multiple pages including dashboard,users pages etc, and they share common stylings, they also have common components like header,sidebar etc, since they all share same styling, i will have to mention it in app component so that it inherit all stylings automatically.
How can i seprate rest of the page stylings with landing page ?
What will be the bets approch to handle this situation?
PS: I was also thinking about creating seprate applications under same project, is this method relevant handling multiple applications with angular cli
?
Yes, having multiple applications makes sense for your case. However, I would recommend keeping login pages free from any framework. We are developing something similar at work. We have login pages with plain html and css. When user logged in successfully, s/he can access angular application. Angular is great and we all love it but it comes with bunch of dependencies you are not aware of. Keeping pages, related to security, free of any framework is better in my opinion. It would mean you have to duplicate stylings for header, footer etc. but it would worth it.
Take a look at this article that is published recently. It lays out a great security risk if you don't know what you are shiping to your users.
P.S: Dependencies of angular are probably OK, however you cannot assume things are safe when it comes to security.
I'm just evaluating how to use Angular 2 for some web applications that sharing some services and components. As far as I understand I can create component libraries to share components. Each component may have it's own css which only effects the component. What is the best approach to share services?
I'm currently using Angular 1 and the bootstrap components. One requirement is, that our application should offer the possibility to create custom skins for it. The application on itself should work in every website by adding a java script snippet. This is a big different to other SPA that are just made to run in one specific website. Currently we offer a bootstrap less variables file which can be customized an uploaded to create via less a new skin. The advantage of this is, that nearly every web designer knows how bootstrap works. But this also means that the css is defined global and not inside the components. What is the best approach to offer people customize css in angular 2 in a very easy way?
In our case it might be needed that two applications interact with each other. In example imagine you have a hotel booking application and a flight booking application. After a user books a flight you may like to offer also the hotel booking application within the same page. Both applications may share the components like a date range selection form or a result page.Is it correct to talk about different applications or would I only create two modules (hotel + flight)? What about lazy load to load only that part that is needed for the current application to reduce the initial loading time on bigger projects?
Any ideas what would be the best structure for that kind of projects?
The way I can picture it is .
Application with two main routes
/Flights
|--Holds other routes for the Flights part of the application
|i.e.
/Flights/flights
/Flights/seating
/Flights/payment
/Hotels
|--Holds other routes for the Hotels part of the application
|i.e.
/Hotels/booking
/Hotels/payment
So it'll be one application with two main routes that nest routes for their specific needs.
We are building a Page with dynamic functionality using ASP.NET + Sitecore 7.0.
Is it practical and appropriate use Sitecore templates for:
SQL Stored Procedure Name to be invoked
JavaScript to be invoked
ColumnNames to be used etc (related to coding customization)
Or should these configuration properties remain inside the ASP.NET Project itself?
What is the primary purpose of Data Templates in Sitecore?
Are they for developer customization or customer-level customization?
The purpose of a data template in Sitecore is to define the set of fields for content items which inherit from that template. - Think of a data template as a class and the content items (pages) as instances of that class.
Templates are usually used to define the user-editable content of pages within a site, that being said you can have items to store information which is not managed by regular content editors. The question is where do you draw the line between things which should be put into Sitecore and things which should be a part of the solution. My advice is only put things in Sitecore if they need to be there. If you have to have the ability for editors or admins to configure those settings/properties.
I would say that putting SQL/ColumnNames is probably a bad idea unless you are building some sort of report builder interface in which case it may be essential?
Likewise with placing JavaScript into Sitecore; this can be OK in moderation (e.g. snippets of analytics code which content editors may want control over?). If you're placing whole libraries of JavaScript into Sitecore, you're probably doing it wrong.
One final point to note is findability/re-factorability of code: if you have code spread between Sitecore and your solution, it can make it very difficult to maintain as it is difficult to get a complete overview of code involved.
How to create dynamic views in asp.net mvc 2.0?
A better way to think about this is to have a generic view page that renders some HTML that administrator defines and which gets stored in a database. Another alternative would be to create static HTML files -- assuming the content is fixed or could be retrieved via AJAX -- and have a view which dynamically chooses which of these HTML files to from your generic view. I use this latter method to make certain parts of a link aggregator site I've put together maintainable by others. It renders HTML fragments (stored in content/static/*.htm) onto fixed parts of the index page/view using jQuery load. The admins have access to modify these files to rearrange/add/delete the links contained on that part of the page. The app is at an early stage of development and eventually these will migrate either into configuration files, and I will generate the HTML, or perhaps I'll develop an administrative interface to manage them and keep them in the DB.
Is there a standard practice to organize the process of developing a simple website. there is no use implementing MVC as there is no data base involved. It will be very useful in organizing the project and separating
the aspx files and master
page content(this can be very useful in implementing simple cms techniques)
user controls
scripts
styles
images
is there any industry standard or best practice for this.?
thanks in advance :)
Update: yes the way i have listed is convenient. but it would be great if i could separate server codes and files like master,aspx.. and the actual page content.
One more reason for not using MVC: I usually outsource the SEO process. Now an MVC application can be greek/latin for my SEO expert. :)
The final structure:
Project
Images
Scripts
Styles
Images
Weblets
Pagelets
aspx files..
the images, styles and scripts will contain only those that are common for the whole project. The weblets and pagelets are in the idea as follows...
Weblets should contain a collection of weblets. A weblet is folder containing a user control,it's styles,scripts,images etc.,
Pagelets should contain a collection of pagelets. A pagelet is a folder containing the content for the aspx page. If there is an aspx file named "aboutUs.aspx" then there is a corresponding pagelet named "aboutUs" which contains aboutUs.html,it's styles,scripts and images. the aspx page should only include them here.This can be very useful in configuring CMS.
If there can be betterments please do post..:)
No industry standards as such, but most developers I know would separate things out the way you did.
i.e. - different types of content in different directories.
That is right there is no such industry standard for this. But in my opinion i really like the Web Application Template from ASP.Net 4.0. It is more like MVC Template but it remain very useful in terms of scalability.
http://weblogs.asp.net/scottgu/archive/2009/08/26/starter-project-templates-vs-2010-and-net-4-0-series.aspx
ASP.Net MVC isn't just for database applications. In fact I would suggest it's easier to work with than webforms after the small learning curve. The concept of convention over configuration will help you with your question. There is a standard structure that MVC sets up for you that works great and anybody that opens your MVC code will be able to understand where everything is.