This is a migrated thread and some comments may be shown as answers.

Identify Computed Columns

5 Answers 112 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Garry
Top achievements
Rank 1
Garry asked on 08 Aug 2010, 03:22 PM
I have a need to identify computed columns, but I haven't been able to figure out how. Below is what I have so far and I have set the Kind property on the column to Calculated, but I can't find that property anywhere on the column at runtime. It doesn't appear to even be in the MetaDataProperties collection. How can I find these columns?

Thanks!

//determine if this scope already exists on the server and if not go ahead and provision
                        foreach (MetaTable table in scope.OpenAccessMetaData.Tables)
                        {
                            Collection<string> syncColumns = new Collection<string>();
                            foreach (MetaColumn column in table.Columns)
                            {
                                if (column.Name != "DisguisedSSN")
                                {
                                    syncColumns.Add(column.Name);
                                }
                            }
                            //add the approrpiate tables to this scope
                            scope.ScopeDescription.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable(table.Name, syncColumns, (System.Data.SqlClient.SqlConnection)remoteProvider.Connection));
                        }

5 Answers, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 10 Aug 2010, 08:04 AM
Hi Garry Clark,

I suggest you to set the Kind property to "PersistentReadOnly" so that this column is being only read by the server which calculates it("Calculated" is bit different option where one should specify his own SQL for calculating the value but, that is not implemented yet). After you do that you should go for the MetaColumn.DataAccessKind property which returns a value from the DataAccessKind enumeration. 

foreach (MetaTable table in scope.OpenAccessMetaData.Tables)
{
    ...
    foreach (MetaColumn column in table.Columns)
    {
        ...
        if (column.DataAccessKind == DataAcccessKind.ReadOnly)
        {
            //do something
        }
        ...
    }
    ...
}

Hope that helps. If any other questions arise please contact us back.


Sincerely yours,
Damyan Bogoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 01 Jul 2011, 01:57 PM
Hi Damyan,

Do you mean that computed/calculated fields in the database are not automatically mapped as DataAcccessKind.ReadOnly
? So, every time I do an 'update from database' I have to set this parameters...?

Erik
0
Damyan Bogoev
Telerik team
answered on 06 Jul 2011, 04:07 PM
Hello Erik,

Yes, the calculated columns are not mapped automatically to read only properties and you should do that explicitly.
I am sorry for the inconvenience caused.

Kind regards,
Damyan Bogoev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ian
Top achievements
Rank 1
answered on 26 Nov 2011, 07:25 AM
Hi,
I'm just getting up to speed on the Telerik ORM.  Is the automatic flagging of database calculated columns (in my case I use SQL Server) going to be improved upon in future?  Just curious.
Thanks,
Ian
0
Ady
Telerik team
answered on 29 Nov 2011, 04:34 PM
Hello Vernon,

Yes, this is very much on the list of features we would like to have and we would be implementing this. I cannot give you an exact timeframe at the moment , but it will definitely be done.

Kind regards,
Ady
the Telerik team

Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
Databases and Data Types
Asked by
Garry
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Erik
Top achievements
Rank 2
Ian
Top achievements
Rank 1
Ady
Telerik team
Share this question
or