Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p>Maybe I'm misunderstanding, but in your model you can <code>right-click</code> > <code>Update Model from Database</code>. In the <code>Add</code> tab, simply select all the stored procedures you want to add to the model.</p></li> <li><p>Not as far as I know. The point of Entity Framework is to avoid having to create your entities manually (code generation). You either create your database first and copy to model or create model first and generate database tables. Either way, the actual .NET entities are generated automatically. If you later change your model, the entities are re-generated. If you could import your own pre-existing entities, you would risk having them overwritten when your model changes. They would also be outside the model's control (how to handle if they're in separate assemblies, etc?). With partial entities (more on that on #3), you can extend the generated classes without risking your customizations getting overwritten. You could still use your existing classes as <a href="http://en.wikipedia.org/wiki/Data_transfer_object" rel="nofollow noreferrer">DTOs</a>, but then you would have to manually convert from the EF-generated entity to your DTO object.</p></li> <li><p>You can't cast a base class to a derived class. See: <a href="https://stackoverflow.com/questions/124336/a-way-of-casting-a-base-type-to-a-derived-type">A way of casting a base type to a derived type</a></p></li> </ol> <p>I'm not sure about .NET 3.5 (EF 1), but entities/complex types in .NET 4 (EF 2) are partial classes. That means you can add members simply by extending the class. So for example, if your custom type was:</p> <pre><code>public partial class Address { public string Address1 { get; set; } public string Address2 { get; set; } public string City { get; set; } public string State { get; set; } public string Zip { get; set; } } </code></pre> <p>You could create a new file with:</p> <pre><code>public partial class Address { public string MyProperty { get; set;} } </code></pre> <p>Then do <code>new Address { Address1 = "abc", MyProperty = "def" };</code>. They'll both have to be in the same assembly and in the same namespace.</p>
 

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