Schema Metadata

8 posts, 0 answers
  1. Richard
    Richard avatar
    18 posts
    Member since:
    Dec 2008

    Posted 09 Dec 2008 Link to this post

    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
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 10 Dec 2008 Link to this post

    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.
  3. DevCraft banner
  4. Richard Harrigan
    Richard Harrigan avatar
    235 posts
    Member since:
    Nov 2009

    Posted 30 Jan 2013 Link to this post

    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
  5. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 04 Feb 2013 Link to this post

    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.
  6. Richard Harrigan
    Richard Harrigan avatar
    235 posts
    Member since:
    Nov 2009

    Posted 04 Feb 2013 Link to this post

    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 
  7. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 06 Feb 2013 Link to this post

    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.
  8. Richard Harrigan
    Richard Harrigan avatar
    235 posts
    Member since:
    Nov 2009

    Posted 06 Feb 2013 Link to this post

    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
  9. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 11 Feb 2013 Link to this post

    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.
Back to Top
DevCraft banner