what is the correct approach in order to host / integrate / show my existing MVC3 project inside orchard? - asp.net-mvc-3

I've an existing MVC3 project that implements a certain functionality, this project has it's own views, and a separate Database.
now I'm required to use the same functionality inside one of my orchard project,so I thought that I can host this solution in somewhere and view it inside an iframe or something.
Am I thinking right?,
is this the correct step to take in order to achieve this requirement inside Orchard?
to make it more clear, all I need to do is to view this solution and interact with it's controls and views from a hosting page inside orchard, and the subsequent requests should be handled by my solution in order to hit it's own data store and get back with the requested data in order to be displayed to the user.
any help would be appreciated.
Update:
thanks for Bertrand Le Roy for his answer, I can now view my solution inside my
orchard website.
I came in to one more HUGE problem, which is that my application can no longer connect to my external database.
I've a DB that is hosted in some where else, and I'm using EntityFramework to deal with it.
the problem is that if I put the connection string inside my module web.config, or main orchard web.config, I run into several types of errors like:
"System.Reflection.TargetException: Object does not match target type."
or
"System.Data.MetadataException: Unable to load the specified metadata resource."
My question is: How could I pass my connectionstring correctly to my solution, assuming that I'm using Entity framework as my ORM.
Many thanks.

You will need to put it into a module.
You will have to move route definitions to a Routes.cs file (look at any existing such file for examples).
You will also need, in order to access your data store, to opt out of the ambient Orchard transaction around the data access code (using (var scope = new TransactionScope(TransactionScopeOption.Suppress))).
If you are using dependency injection, you may have some work to move that to the Autofac-based way of doing things in Orchard.
If you want your work to appear seamlessly in the Orchard admin, you may want to decorate your admin controllers with the Admin attribute. If you want your front-end to use the current theme, you'll have to add Themed attributes and maybe refactor your views so that they only emit HTML for the content zone instead of for the whole page.
Add a manifest (module.txt) to your module folder and you should be good to go.

Related

Extract HTML Helpers from Razor views

Situation
We are rebuilding a web application (winforms), from the ground up. The old application will keep running, when the new one is released. This means that the new application needs to talk to an old database, I can't change anything there. The new application will be build with .NET Core 2.0 MVC.
The old application uses a custom translation database table, based on a language-id and translation-id. Very straighforward.
Problem
The old application made a database call for each translation, over and over again. Because the new application needs to reuse this table, i'd rather have a smarter system. Because of the amount of translations, I don't want to get all data on each page request. I also don't want to make a database-call for each translation.
Idea
My idea is to create a custom HtmlHelper (or dependency injected translation instance, but that might be harder in this situation) which only needs the translation ID. The helper will get the language from a cookie. This way, we can simply use the following code in our views:
#Html.Translate(1337)
What i'd like to achieve, is to use the first Translate-call to scan the RazorView for all Translate-calls (with their parameters). This way, I can use a Dependency Injected Scoped instance to save all the translations to. Which means that I only have to make one database call for each requested view.
Actual question
Does this sound like a good idea, and will this be doable? I searched through the MVC source code, but can't find a way to achieve something like this. The RazorView instance in the IHtmlHelper does not seem to have list of IHtmlHelper's or something...

ASP.NET MVC 5 per user custom built views with widgets

I want to make an MVC 5 app that will allow users to customize views/pages, create new ones. On the custom pages they can set-up widgets and be able to save the views. Also they should be able to setup the default view that will be loaded by default.
Any ideas how can I achieve this? I believe the views should be saved in the database.
EDIT:
I found this template engine RazorEngine. This seams to be what I am looking for. Anybody has any experience using RazorEngine?
I think you should try some CMS like dotnetnuke etc. other wise build your own framework for all the things so that it can save and fetch your details to and from database.

Dynamics CRM Managed Solution Add Customer Set Parameters

I'm creating a solution which will be released as a managed solution for Dynamics CRM Online.
However, the customer will need to put information in when installing the managed solution to allow interaction with outside services.
For example, when you install the LinkedIn solution, you need to add your log in information to allow the CRM to access your LinkedIn account.
How do I add these parameters to the a solution, and then allow the customer to update them if they change?
Cheers
Edit:
To add to my query and following the answer below.
To make sure the process is correct in my head.
Option 1.
I will create a custom entity for storing key/value, or username/password combination.
I would then create a customisation page for the solution using html web resource, which when submitted, javascript would create a single record to hold those values.
I then need to link every record that needs the values stored in the custom record - I'm not sure how this would be done without editing a workflow after the storage record has been created, to link each normal record to the storage one.
Option 2.
Create an xml web resource that stores the values. Create the html/javascript resources to update this using the configuration page.
I can then use a javascript function to obtain that data when the custom entity is created, perhaps to populate hidden fields for storage and use behind the scenes.
I can't find any tutorials on getting started with using xml in this way - can you point me in the right direction?
I typically create a "Configuration" entity that has Name/Value attributes. This is also useful when you have Dev/Test/Prod environments that require different configs (e.g. URLs, credentials, etc).
Another approach is to using Plug-in configurations or Web Resources to store that type of information. The Plug-in configuration is pretty straightforward if you can have the customer use the Plug-in Registration tool to modify the value.

MVC3 Dynamic SubDomain Routing

First of all, I have read a lot of post relating this issue like:
Asp.net MVC RouteBase and IoC ,
Tenant-specific routes for dynamically loaded modules ,
and many others.
What I want is:
- Dynamically create pages like tenant1.mydomain.com, tenant2.mydomain.com, etc.
- My tenants will have the same functionality but just different content, styles, title, etc.
I have tried extending RouteBase class but have read that is not a clean solution.
Then I have tried creating a custom RouteConstraint like above posts recommend but not succeded.
Help me!
Thanks!
I have achieved this by doing two things. 1) was to provide functionality to select the correct content by providing the repositories via a factory which was handed the URL on creation. The issue here is that it might be possible to fetch the wrong data via relationships from entities that themselves don't have a tennantid field.
2) Is a basic custom view engine which looks up the host part of the URL and would look for a client specific template (via a folder structure) if the template was found it was used, otherwise the default template is returned.
Between these two I've got a system that delivers (in my case) multiple websites via the same bespoke CMS and product management tool.

customizing componnet in joomla

i have created a component using this http://www.notwebdesign.com/joomla-component-creator/index.php component creator how can i add a simple registration form in that and also make its backend looks like the other component
The name of that utility is a little misleading since it only creates the structure of a component. If you want to add functionality to the structure created you will need to actually put in the code that does what ever you need it to do. Think of this as the foundation and framework of a house. You actually have to put the walls up and furnish it.
It would probably be helpful to understand the files that have been created for you so you know what needs to be added. I would recommend learning how to build a component from scratch first. Joomla has pretty good documentation on that here - http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
i have develop the Lots of component from this site http://www.notwebdesign.com/joomla-component-creator/index.php .
1) First Create the components and give the name and crrate the require field fo the registration from .and save the components then after the download this components.
2) Install the components in your joomla site.
3) Go to the Fornt-end view components folder. and create a form in the default.php page and save and update operation query is written in the model .
Your Registration page is ready.
This tutorial is the best I have come across so far. It will hopefully guide you to understand the MVC structure that the component generating site delivers to you.
I am actually the developer of the Component Creator you have used. It only creates the MVC files and structures needed to quickly create a component. You still need quite good PHP skills to develop a fully working component.
The component creator helps developers with the tedious tasks of building the framework.

Resources