Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> MVC 3 Sample w LLBLGen
 

Pages: 1
LLBLGen Pro Runtime Framework
MVC 3 Sample w LLBLGen
Page:1/1 

  Print all messages in this thread  
Poster Message
etechpartner
User



Location:
Los Angeles
Joined on:
23-Aug-2006 22:02:37
Posted:
94 posts
# Posted on: 24-Apr-2011 15:37:45.  
Looking for an MVC sample app using LLBLgen.
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 24-Apr-2011 22:12:06.  
There is no examples for MVC. If you had used LLBLGen and you had used MVC, there is no much to tell: fetch the entities in your controller and pass them to the view. I have a couple of examples. I will post one here later today.

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 26-Apr-2011 07:58:00.  
I've an MVC2 example. Let me give you it in MVC3. Please give me a couple of hours...
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
etechpartner
User



Location:
Los Angeles
Joined on:
23-Aug-2006 22:02:37
Posted:
94 posts
# Posted on: 27-Apr-2011 01:57:09.  
David thats very nice of you. Do you happen to have a way to map entities to models and extend them with DataAnnotations?

  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 27-Apr-2011 13:33:58. Goto attachments  
Hi there,

I had an example for MVC2 but it not uses an example database (it uses one of mine), so I write down a tiny MVC3 example using Northwind. You can learn the basics from it.

It's not much different from MVC2 really. I use the default ASP.Net view engine (not Razor), no html5, just the basic stuff. You can add those if you want.

Also, in MVC there is not much different from LLBLGen and other frameworks. The default binder works very well with LLBLGen entities.

When you pass an entity from a view to the controller, the mvc binder pass the fields as form parameter collection. A nice addition is to tell MVC to pass an entity back and forth between the controller and the view, instead of parameters. To do that I used the Brian Chance's LLBLGenModelBinder class (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17343).

The DataAnnotations is very easy to add. You can do it in a partial class in you entity model project or via buddy classes. I added a few validation decorators to show this.

All you need to run this example is: Northwind db, VS2010, MVC3, LLBLGen v3.1.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
etechpartner
User



Location:
Los Angeles
Joined on:
23-Aug-2006 22:02:37
Posted:
94 posts
# Posted on: 27-Apr-2011 14:25:49.  
That sounds great. Where do I find the file?

  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 27-Apr-2011 14:33:18.  
There is a tiny clip in my above post. Or click here: http://www.llblgen.com/TinyForum/Attachments.aspx?SourceType=1&MessageID=111280
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
etechpartner
User



Location:
Los Angeles
Joined on:
23-Aug-2006 22:02:37
Posted:
94 posts
# Posted on: 27-Apr-2011 14:37:53.  
Got it ! Thanks. Appreciate it

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37879 posts
# Posted on: 27-Apr-2011 14:45:24.  
Great work David Regular Smiley

Also to add attributes to entities, navigators etc., you can do that in the designer (at the project level for example to define it once and add the attributes to all entities, fields etc.)
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
scotru
User



Location:
College Place, WA
Joined on:
16-Feb-2006 01:03:42
Posted:
104 posts
# Posted on: 22-May-2011 10:14:29.  
Thanks for sharing this David! Is it possible to use this with MVC Scaffolding?

  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 22-May-2011 22:26:58.  
What version of MVC are you using?
Do you use some special custom scaffolding package or the default one?
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
scotru
User



Location:
College Place, WA
Joined on:
16-Feb-2006 01:03:42
Posted:
104 posts
# Posted on: 23-May-2011 08:07:54.  
I'm using MVC 3. I'm just trying to get basic scaffolding working. I've tried using the UI to create the controller with scaffolding in Web Developer 2010 as well as using the package manager as described here:

http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/



  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 24-May-2011 06:47:34.  
I never looked at MCV scaffolding and LLBLGen, the closest thing is the DynamicData support released time ago. Let me take a look at scaffolding to see if it's possible. I will post the results tomorrow.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
scotru
User



Location:
College Place, WA
Joined on:
16-Feb-2006 01:03:42
Posted:
104 posts
# Posted on: 25-May-2011 00:03:17.  
Awesome--I appreciate that. Scaffolding is the only thing making me tempted to use EF4 instead of LLBLGen right now with MVC 3. I'm tired of spending too much time writing CRUD :-)

Thanks!



  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8110 posts
# Posted on: 25-May-2011 07:41:31.  
The default and only option is EF for scaffolding. Nevertheles you can override the templates to write your own code:
http://blog.stevensanderson.com/2011/04/06/mvcscaffolding-overriding-the-t4-templates/
http://stackoverflow.com/questions/4692311/how-do-i-create-my-own-scaffold-template-in-asp-net-mvc-3

As this are very straight-forward templates, you also could write your own LLBLGen templates to generate that. It should be relatively easy to do, if you want to give it a spin.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.