Merge an existing MVC application with a new one - asp.net-mvc

I am developing an MVC4 public facing website which should have a blog, I didn't want to develop one from scratch so I got a nice open source one from codeplex.
Herein lies the problem: I have to integrate this into the site I am building, I can't have a random link sending the user off to a separate blog site as I have to display sections from the blog on my original site.
I thought about using Areas which I will give a go after posting this but I was interested in knowing if there is a better way to do this or caveats that i need to be aware of etc.
Thanls for all the help :)

So I managed to do this with a bit of tinkering.
First I added the source code projects to my solution. Then I created an area called Blog and deleted all of the boilerplate stuff except BlogAreaRegistration.cs. I then looked at the References and referenced all corresponding libraries as well as the accompanying class library projects.
I copied all the folders except App_Data, Content and Scripts into Areas/Blog. Copied the previously mentioned folders to their respective locations in the root website.
I then compared both Global.asax's and web.configs, copied across the missing sections into my own files (not without the help of Examdiff for the configs).
I then had to copy the default ViewTemplates from the Areas/Blog/Views directory to the root Views Folder.
...press F5 and voila!
Ofcourse I make it sound like a disney fairytale bbut it was alot more difficult with lots of trial and error (of a yellow screen of death kind).
Well, that's my 2 cents just incase anyone else runs into the same murky waters in the future

Related

Intellisense namespace discovery in Visual Studio not working after moving files to another project

I started with a single ASP.Net MVC project named Yogabandy2017 that had a folder called viewmodels. I stored all the viewmodels in it.
I moved all the files from that folder to another project called Yogabandy2017.Models where I stored all my models and I created a folder in it called Viewmodels where I put all the viewmodels, I also changed the namespacing in each of the viewmodels to match.
Then I did a large copy and 'replace all' in each view so that each view can now point to the correct folder like this
from this
to this, where I added the .Models to make the path correct
But intellisense still hasn't changed and picked up the correct path. I've tried to clean the solution, rebiuild it a couple of times. and still the path isn't connecting correctly. I still have the red underline and an exception being thrown when traversing the page saying it can't find the path.
Is there any way to get these paths to reset without going to each file and rewritting them manually? I have a few hundred and going through each one by one to make the change will take forever.
Any help would be appreciated...
Check your cases...
YogaBandy2017
vs.
Yogabandy2017

Is it possible to have same resource names (for resw) in different directories?

Normally, when you read about localization resources (RESW) for a universal application you are asked to create a single resource file for each language with Resource.resw name or in a most advanced scenario they advice to create two or three like Errors.resw, Messages.resw and that's about it. We have completely different approach (let's don't argue upon this, for us it proved to be good). We have a separate RESW file matching a CS file where we have resources which needs to be localized. We mimic the same folder structure in the Resource(language)\ folders as we have in the source code. The whole pattern came from Windows Phone Silverlight application and worked perfect with RESX. I have concerns regarding this in universal app. The problem is that even though a RESW file is located deep in the directory structure like
Res\it\Controls\Browser\MusicDetails.resw
it is referred as if it is located in the language root at Res\it. For example to get this resource in the code the code would look like this
resourceLoader = ResourceLoader.GetForCurrentView(currentAssemblyName + "/MusicDetails");
resourceLoader.GetString("Title");
Getting back to windows phone silverlight app the path in a similar case looks like "\Controls\Browser\MusicDetails.resw" and it is definitely not an issue for the RESX resources.
Is there something we are missing or it is a hard RESW limitation and all RESW files no matter where they are located in the directory structure are treated as if they are at the root of the language directory? I foresee a problem if in the future we have exactly the same RESW name in different directory branches. How to work around this?
I think is not possible to do that, I tried to do something like you before with Windows 8.1 and it was not possible now with UWP is the same we need follow the guidelines here
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh965328.aspx
I did this steps and it works like a charm.
UWP apps have restrictions they are not like traditional apps (Win32 apps)

How can I route my solution into different projects?

I'm looking for a solution to be able to store my websites in individual projects, while keeping one project as an entrypoint that can route into those projects.
The ideal setup would be something like the following:
- Main (entrypoint)
- Website1
- Website2
- Website3
I need this format to allow someone to access their website (ie. Website1) as a solution they can run and debug on their own, without having access to the entire application.
Basically, I want to be able to set up a new project, add the reference to the Main project, add an entry into my routes, and allow the new project to be built out and tested if it needs to be.
Is this possible?
I've looked at using areas and tried several plugins, but I can't seem to get this working properly. My biggest issue right now isn't routing into the project's controller, as I can get into that action perfectly, but once there, I can't reference any of the ASPX files properly. (I need to be able to reference them within the context of the project and the entire solution.)
If anyone could direct me towards other resources or questions I might have missed, I'd appreciate that as well. Thank you!
You should be able to doe this using a source control program of your choice. Put each website project in a separate folder and reference each website project file to a main master.sln file in a different folder called MasterSolution. Commit it all to source control. Then, for a user that opens Website one only, they just do open project, and go to the Website1 project folder and open the project file for Website1. Your MasterSolution is not opened but always gets the latest code as after the Website1 developer does a commit of his/her Website1 updates.

Asp.net MVC, adding edmx gives trusted zone warning

I have an ASP.net MVC 4 project I am working on and am trying to add an ADO.net EF model to it using Database First.
The creation of the model (.edmx file) seems to run successfully and I am left with the desired .edmx model file in the folder I specified. However, I don't appear to be able to see any of the files nested under this model. (From all my research, I should be able to expand the .edmx file and see *Context.vb, *Designer.vb, *.edmx.diagram and *.tt files underneath, but I cannot.)
It should look something like this in the msdn article about Database First (see Step 4):
Upon noticing this issue, I discovered a handful of warnings that appeared after creating the .edmx model, one of which is (I have obscured part of the full path):
The path 'P:\IT\...\DAL\EF.Utility.VB.ttinclude' must be either local to this computer or part of your trusted zone. If you have downloaded this template, you may need to 'Unblock' it using the properties page for the template file in File Explorer.
The project is stored on a network share on one of our servers so it can be included in our daily backups and Windows Shadow copy also. My understanding is that the above warning has appeared because of this and I need to set my machine to trust this location.
I have tried all possible variations I can think of of
this MSDN article
but to absolutely not success at all, the warning remains.
Either I am looking in the wrong place, or I have missed something.
Does anyone know what I can do to remove this warning and gain access to the objects nested below the .edmx model?
Perhaps this could be of some assistance. I've never really dealt with trust issues working across the domain. I lean towards pulling down and working with a local copy.

Get Plone 4 to import pictures as images and not files when uploading with webdav

I remember back in Plone 2 days I found a simple hack to make one CMFPhoto folder receive webdav files as images (and show them as a gallery).
In Plone4 the images are received as content type files which are not very useful.
Other mass uploading options seem not to be updated to recent versions of Zope/Plone, except uploadify, which makes my server unable to start when installed with buildout.
Functioning webdav would be ideal
Thanks for any ideas, although I can't say I have understood the framework enough to use just a hint
Steen
The short answer is that you need to take a look in the Content Type Registry tool within your site and figure out the settings related to the image (png, jpg) extensions and mime-type that are configured for your site. Visit the Zope Management Interface of your site, and go to ./content_type_registry in he root of your site to take a look.
The more complicated answer is that folders in Plone have a method called PUT_factory() that controls what items get created as. Different folder types can behave differently, but all stock folder types in Plone and most add-ons should obey (unless a bug) the settings in the Content Type Registry.

Resources