This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I was wondering how would I add en enum type to an entity? It seems that it is not possible with the designer (2.2), so I have to add it manually? I'm not sure what is the correct way, any hints? I'm also newbie with ASP.NET web development, and I'm trying to figure out what is the best way of making a simple data enabled site (for administration). I've been thinking about using the ASP.NET MVC Framework and different controls from DevExpress (for example data grid). But after few hours of reading about data sources, data binding, linq, linq to sql, linqdatasource, asp.net dynamic data etc., I'm a bit lost. I want to do basic CRUD, how would I connect LightSpeed ORM with a data editing grid? |
|
|
You're right that the designer won't generate enum types for you, so you have to write the code for those by hand. However you can still have them participate in designer database synchronisation and get some help from the designer as follows: 1. Create the property in the designer and set it to an appropriate integer type (usually Int32). If you created the entity by dragging from Server Explorer then this should already be done for you. Save your changes. 2. If you haven't already created a partial class for the entity, do so now. (If you are using a recent nightly build, a shortcut for this is to right-click the entity and choosing Refactor > Create Partial Class.) 3a. If you are using a recent nightly build, right-click the property and choose Refactor > Convert to Manual Implementation. Select the partial class file and choose OK. 3b. If you are NOT using a recent nightly build, open the generated .cs file and find the generated field and property code. Copy this to the partial class file. Then go into the designer, select the property and change its Generated setting to None. 4. Go into the partial class file, which now contains a copy of the previously generated code. Change the ints to the appropriate enum type. Important: this code is now disconnected from the designer: it is up to you to maintain it if you need to add validations, etc. The designer will no longer update it for you! Regarding making a simple CRUD site, ASP.NET Dynamic Data is a quick and low-maintenance way to create a very basic admin site. The help file contains info about creating a dynamic data site using LightSpeed. I'll ask one of our Web gurus to chime in on the "full" ASP.NET options. |
|
|
If you are building a fairly simple administration site (e.g. basic CRUD), you should have a look at ASP.NET Dynamic Data ( http://www.asp.net/dynamicdata/ ) as this is probably going to be the simplest way of achieving what you want. You can easily connect your LightSpeed models up to a dynamic data site as detailed here: https://www.mindscape.co.nz/help/ls20/Help%20Topics/Web%20Tools/DynamicData.html :)
|
|
|
Ok, thanks! I'm using the nightly build now and I did as you advised. I converted the property to Manual Implementation, but there's one problem. The property won't show in the *Dto class? Should I create my own DTOs? I'm using these with WCF, so they're quite useful, but as everything else is already so automated, I wouldn't like to do these manually :) |
|
|
The DTOs are partial classes so you can add a custom property to the corresponding *Dto class (though the Refactoring menu won't help you with this, you'll have to do it by hand). You will also need to implement the partial copy methods to copy the custom property between the * and the *Dto class. You'll probably need to have a read of the generated code for the details of the partial methods and for what the property and copy code should look like -- if it doesn't make sense then give us a yell and I'll write it up in more detail! |
|