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
|
Hello. This is a "feature request" for Ivan. I would like the ability to bind a LightSpeed entity or list of entities to an ObjectDataSource for use within an ASP.Net 2.0 page. A basic version of my methodology which I use can be viewed here: http://www.asp.net/learn/data-access/tutorial-02-cs.aspx The principle is fairly simple
Particular attention will need to be made to the necessary interfaces etc. that the ASP.Net data sets implement, so the ObjectDataSource can work its magic and work out what is going on. Cheers Ivan. Bert |
|
|
Hi Bert, Can I clarify the scope of what you are looking for here? I have not used ASP.NET data binding very much so I don't really have a great feel for the way you are working, and would appreciate your guidance! 1. Apply DataObjectField(true, true) to Entity.Id, so that ObjectDataSource knows to pass the ID to the Update and Delete methods, and so that controls can infer it for their DataKeyNames property. This seems to be essential to the use of ObjectDataSource and I have now put this in for the next nightly. 2. In the designer, apply DataObjectAttribute to entity classes. This seems to be more a convenience thing since ObjectDataSource will work with anything (also you can apply it on the partial class). We can add this to the designer code template very easily if it would be useful for you. 3. Generate DataObjectField annotations from the designer. This doesn't seem to be essential to get ODS working -- I didn't need to do it for my tests -- though I can see it would help with nullable fields or for string length validation. Again, we can add this to the designer code template pretty easily if it would be useful. 4. Generate Select, Update, Insert and Delete methods with the DataObjectMethod attribute. You (and the article you link to) describe these as being part of your business logic layer, however, which implies that you prefer to craft specific methods such as GetProductsByCategoryID rather than just have the generic CRUD methods. Again, we can generate the plain CRUD methods (select all, and insert/update/delete by ID) for you relatively easily, but I am not sure if this is what you want. 5. Additional designer support. From my testing, the ObjectDataSource correctly picks up all the entity properties, so I am not sure what further support you would be looking for. I noticed that ODS likes to set its OldValuesParameterFormatString to "original_{0}" which seems a bit odd, and that the databound controls by default try to display and edit object references, which is undesirable. Is this the sort of thing you are thinking of? If so can you provide any pointers -- I couldn't see any way to override these behaviours, but I am not very familiar with ASP.NET data binding, so I may well be missing something! 6. Something else I am missing? Longer term I think we may be better off implementing a LightSpeedDataSource component similar to the SqlDataSource, which would provide a much more integrated design experience. It would also make for a better runtime experience -- e.g. with ObjectDataSource all paging is done in memory (rather than in the database), which is inefficient for large data sets, and ODS doesn't allow sorting (unless your source is a DataTable or DataView). I have started work on a LightSpeedDataSource and it would be great if you could provide me with some feedback on whether the limitations I have mentioned with ODS justify this for you, or what is most valuable for you in terms of design-time and run-time support. |
|