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, What's the best way in Lightspeed to ensure that all entities derive, not directly from LightSpeed's Entity Thanks, John |
|
|
For the designer, add a defaults policy (View > Other Windows > LightSpeed Model, right-click Model, choose Add New Defaults Policy) and set the Base Class to your supertype. If your supertype is hand-coded rather than being represented on the design, you'll need to add it as an External Class Reference first. Note that this sets your supertype as the default for creating new entities -- it will NOT change existing entities to be based on the supertype, and it will NOT prevent bad guys from changing or removing the Base Class after creating an entity. For hand-coded entities, you would have to remember to derive from your supertype class. A Visual Studio snippet could help with this. If you want to actively 'ensure' that all entities derive from the layer supertype, regardless of error or *ahem* ingenuity on the part of your minions, that's not built into LightSpeed. But it should be pretty easy to e.g. write a FxCop rule to check for this. |
|
|
Perfect thanks. And yes, I'll do an FxCop or reflection-based unit test or something to make sure. John |
|