Dynamic ASP.NET MVC

No description »
Amir Rajan

Specwatchr
(via nuget)
coding
js, cshtml, css
deploy
class
build
find test
run test
test
.cs
rawrr
compiler
error
FIRST failure
or success
designing
rake
server
iis
express
rake
rake
sample
create
schema
sample
data
rake
reset
rake-dot-net
(via nuget)
rake
tests
deploy
success
Oak
(via nuget)
seed
new
{
    Title = "Title",
    Body = "Lorem", Ipsum"
}.InsertInto("Blogs");
CreateTable("Blogs", new dynamic[] 
{
    new { Id = "int", Identity = true, PrimaryKey = true },
    new { Title = "nvarchar(max)" },
    new { Body = "nvarchar(max)" }
}).ExecuteNonQuery();
Massive
by Rob Conery
public class Blogs : DynamicRepository
{
    public Blogs() 
    {
        //hook provided by oak
        Projection = d => new Blog(d);
    }
}
HomeController
public class HomeController : Controller
{
    public dynamic Blogs { get; set; }
    
    public HomeController()
    {
        Blogs = new Blogs();
    }
    
    public dynamic Index()
    {
        ViewBag.Blogs = Blogs.All();
        return View();
    }
}
public class SeedController : Controller
{
    public Seed Seed { get; set; }
    
    public SeedController() { Seed = new Seed(); }

    [HttpPost]
    public ActionResult PurgeDb()
    {
        Seed.PurgeDb();
        
        return new EmptyResult();
    }
    
    [HttpPost]
    public ActionResult All()
    {
        CreateBlogs();
        
        return new EmptyResult();
    }
    
    public void CreateBlogs()
    {
        string createCommand = Seed.CreateTable(
            "Blogs",
            new dynamic[]
            { 
                new { Id = "int", PrimaryKey = true, Identity = true },
                new { Title = "nvarchar(255)" },
                new { Body = "nvarchar(max)" }
            });
            
        createCommand.ExecuteNonQuery();
    }
    
    [HttpPost]
    public ActionResult SampleEntries()
    {
        new 
        { 
            Title = "My First Blog Post",
            Body = "First Body" 
        }.InsertInto("Blogs");
        
        return new EmptyResult();
    }
}
SeedController
NSpec
(via nuget)
Dynamic MVC
Amir Rajan
Principal Consultant
Improving Enterprises <-- we're hiring!
www.amirrajan.net <-- code will be here
@amirrajan <-- follow me
important Stuff:
- friction
- test driven development
- boiler plate
- feedback loops
- essence vs ceremony
Gemini
System.
DynamicObject
Validation
Change
Tracking
associations
DynamicModel
Blog
System.
ExpandoObject
FRICTION
running tests
building
debugging
creating db schema
starting a new project
bring on additional devs
creating sample data
Get rid of the friction.

Get. Things. Done.

keep things DRY

YAGNI

write tests that actually bring value
boiler plate development
amirrajan.net, @amirrajan

github.com/amirrajan/oak, specwatchr, rake-dot-net
github.com/mattflo/nspec

install-package oak, specwatchr, rake-dot-net, nspec
Dynamic MVC
ParamsModelBinder
DynamicForm
Oak.cshtml
ElementMetaData
- Dallas Hack Club is about getting better at development
- free pizza, pair programming, code katas, no slides, no presentations

http://dallashackclub.com/
- Dallas Hack Club is about getting better at development
- free pizza, pair programming, code katas, no slides, no presentations

http://dallashackclub.com/

Loading comments...

Please log in to add your comment.

Report abuse

More presentations by Amir Rajan

More prezis by author