Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate Database / Entity Data Model from C# Classes
    primarykey
    data
    text
    <p>I have been using Subsonic with MVC.NET and love the feature that allows me to generate a database from the c# classes. This is great because it allows you to think about the app first and the data second.</p> <p>Now that I am moving onto MVC.NET 2.0 - I am using the features in the Entity Framework which are great giving form validation client and server side natively.</p> <p>For example, I have a class in my model...</p> <pre><code>public class StackOverflow { [Key] public int PropertyID { get; set; } [Required(ErrorMessage = "Title Required")] [StringLength(50, ErrorMessage = "Must be less than 50 charceters")] public string Title { get; set; } } </code></pre> <p>...my question is, can I use the c# class to define the edmx and then use this to generate the database?</p> <p>Also, if this is possible - is this good practise?</p> <p>Edited to add.. Just to clarify, with Subsonic I can go into the controller as add</p> <pre><code>var sof = new StackOverflow(); sof.Title = "Lorem ipsum dolor sit amet"; var repository = new SimpleRepository("connString", SimpleRepositoryOptions.RunMigrations); repository.Add(sof); </code></pre> <p>and my database is created, is there no way to go from class to model or class to dbase or is creation of this a separate activity?</p> <p>Im trying to follow the m$ EF model as I beleive this will be that way MVC3 will go and Subsonic while great for speed (and making $$$) will render me out of date quickly.</p> <p>Do I need to choose between ef4 or Subsonic and an alternative validation model for now?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload