posts - 81, comments - 262, trackbacks - 0

Sunday, December 2, 2012

Migrating an MVC site to Orchard Project 2 (Part 2)

I've started migrating my application into the module. The major consideration has been handling the use of LINQ to SQL and the Entity Framework together.

  • My MVC application uses LINQ to SQL. I had to regenerate the data context with sqlmetal to resolve some odd errors when working with NHibernate. In particular my data context was generated by an old version of sqlmetal – it just needed an updated generation. I found it useful to create a BAT file to regenerate the context for me.

    call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"

    sqlmetal /server:MACHINENAME /database:DBNAME /code:DataContext.cs /language:csharp /views /functions /sprocs /namespace:Models /context:DataBase

  • I ran into an issue with my 'Distributed Transaction Coordinator' service not running. This threw a run time exception during my module development. It appears to be needed when my LINQ to SQL context and Orchard's NHibernate context use transactions at the same time.
    • The solution was using a new TransactionScope around the LINQ to SQL calls with TransactionScopeOption.Surpress.
  • During the development of a module I needed to uninstall the module from the database. There were two options, I used the later.
  • I found this tutorial on developing a content part useful. It is detailed and provides another perspective. Yet another useful tutorial in creating a content part is found here. Finally, there is the very basic tutorial on creating a map content part which is perhaps the most useful for its minimalism.
  • Turning a content part into a widget is straightforward through the Migration class.

The next step is for me to migrate my Controllers and Views into the module. Part of this is integrating my authentication within Orchard.

posted @ Sunday, December 2, 2012 2:55 PM | Feedback (13) | Filed Under [ Web Programming ]

Powered by:
Powered By Subtext Powered By ASP.NET