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
|
Have got a table with a couple of computed columns in it What is the best way to define this in the Lightspeed designer ? (have had a look thro' documentation and this support forum - cant seem to find any info :-( )
|
|
|
The classes that are created by Lightspeed, are partial ones. Thus I use them for computed columns, like this: partial class User |
|
|
marton thx for the reply. that looks like 'Transient' columns in the definition but what if the computed column is on the database table - how do i tell Lightspeed to ignore it ? (or am i missing something ?) m |
|
|
I think simply remove the Entity Property and then Lightspeed won't use that for update or insert (and select, too...). If you still need the value, you can compute them in the c# code, or use views for select. Btw I never use persisted computed columns, they are so painful :) |
|
|
that sounds like a likely candidate thx - will give it a try |
|
|
Sorry to revive this old post... I just want to double check with Mindscape guys and the community :) I'm using: VS2010, SQL2008, Nightly from 08/08/2010. I have a Person table in a SQL Server database with columns like: FirstName, LastName, MiddleName NULL. And also a computed column called FullName. When updating the model with "Update From Source", I was expecting to see some sort of differences between a normal column (FirstName) and a computed column (FullName). Instead, I see the FullName column got imported as a nullable string property. Is this correct? Or do I need to do something special for a computed column? Should its Transient or Load Only be set? And why is it considered as nullable? |
|
|
For a computed column, you need to stop us trying to save it. To do this, set the LoadOnly option. (Don't set Transient, because then we'll ignore the field completely and it won't get loaded.) LightSpeed is not yet smart enough to work for itself that the column is computed, so this is a manual step for now. The designer is showing it as nullable because SQL Server is telling us that it is nullable. I'm not sure how SQL Server works this out for a computed column, possibly based on the nullability of the source columns, but that's what it tells us and we just go along with it. (In practice this is a non-issue anyway since the CLR string type is inherently nullable so the Is Nullable option doesn't make a difference.) |
|
|
Thanks Ivan! |
|