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

Schema Metadata

7 Answers 125 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 09 Dec 2008, 06:49 PM
Hi,

I need a tool that when pointed to a database thru an API call will return the following metadata:

Tables
Columns
Primary Keys
Foreign Keys
Indexes

Does OpenAccess ORM provide this functionality?

Thanks

Rich

7 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 10 Dec 2008, 02:25 PM
Hi Richard,

yes, in a sense: Our reverse engineering process obtains the schema from the database server and stores it locally into a file named 'reversemapping.config', located in the VS project directory. You do not need to create classes to get that file. Later you could process that with XML.
Other than this, there is no direct get-me-the-raw-sql-metadata API for such a purpose.

Sincerely yours,
Thomas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Richard Harrigan
Top achievements
Rank 1
answered on 31 Jan 2013, 12:34 AM
Hi,

That question/answer was from 5 years ago.  I was wondering, has anything changed?  I am still looking for something like Sql Server SMO that would work across numerous data sources.  Obviously OpenAccess has a way to get the schema for each supported data source.

Thanks
Rich
0
Damyan Bogoev
Telerik team
answered on 04 Feb 2013, 08:41 AM
Hi Richard,

You could find the attached tool useful. You need to add the connection strings under the configuration file
to be able to query against given database.

Hope that helps.

All the best,
Damyan Bogoev
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
0
Richard Harrigan
Top achievements
Rank 1
answered on 04 Feb 2013, 07:59 PM
Hi,

Nice program, however I need to get the schema info from within my program.  That is I would need something like the API that your open access management example is using.  Would it be possible to get access to the library used by the open access management program? 

i.e.  List<Table> tables = Server.Database.GertAllTables();    etc. etc.

Thanks
Rich 
0
Damyan Bogoev
Telerik team
answered on 06 Feb 2013, 09:08 AM
Hi Richard,

I have prepared a sample application which demonstrates how to use the OpenAccess ORM Schema Reading API to obtain the needed information from the database.

You could filter the schemas and the relational items to be read from the database using the SchemaReadParameters instance. The ISchemaReader.GetSchema(parameters) method populate a MetadataContainer based on the obtained schema.

Hope that helps.

Regards,
Damyan Bogoev
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
0
Richard Harrigan
Top achievements
Rank 1
answered on 06 Feb 2013, 09:22 PM
Hi Damyan,

Wow, your example exceeded my expectations.  I just have a few initial questions but I'm sure I will have more later.

1.  How do I map from SqlType/AdoType to SystemType and what if anything special do I have to do for different databases?  (Currently I only need system.type for my purposes).

2.  The example used the backend name of "mssql", What are the backend names for each supported database.

3.  In general when must I be aware of the underlying database?

4.  Please reference me to any specific documentation you think would be helpful.

5.  Any plans for Teradata?  I have good contacts within Teradata (I'm an x employee) and  would like to show them OpenAccess. I would be glad to help with the testing.

Many Thanks
Rich
0
Damyan Bogoev
Telerik team
answered on 11 Feb 2013, 03:47 PM
Hello Richard,

1. You need an ITypeResolver instance in order to retrieve the correct CLR Type based on a given SQL Type. In order to achieve this goal you need to add the following code snippet to your application:

// the code snippet is based on the provided sample in the previous answer
MetadataContainer container = reader.GetSchema(readParameters);
ITypeResolver resolver = reader.GetTypeResolver(container);
foreach (MetaTable table in container.Tables)
{
    foreach (MetaColumn column in table.Columns)
    {
        Type clrType = resolver.MetaColumnToClrType(column);
        ...
    }
}

2. The Telerik.OpenAccess.Metadata.Backend enumeration declares the names of all supported backends in OpenAccess ORM. You could retrieve a list with backend names based on this enumeration type.

3. You need to be aware of the underlying database only when you want to execute operations against it - schema reader, query execution, schema migration, ect.

4. I am afraid that currently we do not provide such documentation.

5. Teradata is not on our to-do list. If this is important to you, please feel free to add an entry to our Ideas & Feedback portal.

Kind regards,
Damyan Bogoev
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
Tags
Design Time (Visual Designer & Tools)
Asked by
Richard
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Richard Harrigan
Top achievements
Rank 1
Damyan Bogoev
Telerik team
Share this question
or