Monday, May 26, 2014

Porting an MVC4 App from VisualStudio to MonoDevelop

I recently created a demo shopping cart application using VisualStudio Express 2013 and MVC4. This meant spending some time in Windows.  But, I was quite impressed with MVC4. This is a vast improvement over the old viewstate based web apps. Plus, there is asset bundling support. This was worth the time spent using Windows.

When I was done, I wanted to log back into my Linux machine and port my project to Mono. The first thing I did was upgrade to Mono 3 and MonoDevelop 5. And then I set about porting my demo. MonoDevelop only has MVC3 templates, so first, I had to find an MVC4 template, Now I was ready to get started.

With most IDE's, you can just drop files into a folder and forge ahead. But MonoDevelop uses the VisualStudio project structure that mirrors the file system. So I  fired up MD, loaded my template, renamed it, and deleted all of the boilerplate. Then I visited each project folder, right clicked, selected Add Files from Folder, and dragged in all of the source from my original project.  This worked for everything except the Model.

Since Linux doesn't support MSSQL, I decided to use MySQL, with NHibernate for my ORM. I prefer a database first design process, so the first thing I did was update the sql script that creates my database and stored procs. Then I copied in the domain objects created by EntityFramework, changing the properties to virtual. The real work was creating the xml bindings -  but I actually prefer doing it manually, it is much easier to update than the tedious VisualStudio process of deleting and rerunning the wizard. Plus, you have much more control over the final product.

Thas is it. You can see the result at http://monomart.apphb.com. And compare the projects on github. The original VS project is at https://github.com/darkoverlordofdata/minimart, and the MonoDevelop project is at https://github.com/darkoverlordofdata/monomart.

12 comments:

  1. It was really a wonderful article and I was really impressed by reading this blog. Your technical information is very useful for me. Thanks for sharing your ideas.

    Regards...
    Hacking Course in Chennai

    ReplyDelete
  2. Much thanks to you a cluster for offering this to every one of us you really acknowledge what you are discussing! Bookmarked. If you don't mind likewise look for guidance from my site =). We could have a hyperlink change contract between us! FtiOS Android

    ReplyDelete
  3. I truly welcome the sort of points you post here. A debt of gratitude is in order for sharing us an incredible data that is really useful. Great day! Tinyumbrella Mac

    ReplyDelete
  4. I was surfing net and luckily ran over this site and discovered extremely fascinating stuff here. Its truly amusing to peruse. I delighted in a ton. A debt of gratitude is in order for sharing this magnificent data. NessTool Download

    ReplyDelete
  5. Awesome information! I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't recognize what to say with the exception of that I have. Mojo Installer

    ReplyDelete



  6. Tutu Helper is the one of the best ios,android App store to get the tons of free app

    and game. Here the latest version of TutuApp of free.
    Tutu Helper Apk
    Tutu App
    TutuApp Apk iOS

    ReplyDelete
  7. cartoon hd is the best app to watch movies tv like cartoon online Cartoon HD Apk

    download noow stream App also so watch now
    Offroad Outlaws mod Apk
    Marvel Future Fight Mod APK

    ReplyDelete
  8. The white oak kitchen cabinets offer timeless beauty and durability. Known for their distinct grain and warm tones, they complement a variety of kitchen styles, from rustic to modern.

    ReplyDelete
  9. Transform your kitchen into a contemporary masterpiece with modern kitchen design ideas. Sleek lines, minimalistic aesthetics, and smart storage solutions create a functional yet stylish space.

    ReplyDelete
  10. RTA kitchen cabinets offer a cost-effective, stylish solution for kitchen remodels. Shipped in flat packs, they’re easy to assemble and install, making them perfect for DIY enthusiasts.

    ReplyDelete