The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Accessing the On-Board Metadata

Last post 05-10-2007, 4:59 PM by ESAdmin. 0 replies.
Sort Posts: Previous Next
  •  05-10-2007, 4:59 PM 2328

    Accessing the On-Board Metadata

    As of EntitySpaces 2007 v0.0507, we have exposed the IMetadata interfaces on the nested "es" variable. This example is using the Employees class generated from the Microsoft SQL Northwind database.

     

    Code:
    Employees emp = new Employees();
    esProviderSpecificMetadata spec = emp.es.Meta.GetProviderMetadata("esDefault");
    foreach (esColumnMetadata col in emp.es.Meta.Columns)
    {
    Console.WriteLine("PropertyName: " + col.PropertyName);
    Console.WriteLine("ColumnName : " + col.Name);
    Console.WriteLine("CharLength : " + col.CharacterMaxLength.ToString());

    esTypeMap map = spec.GetTypeMap(col.Name);

    Console.WriteLine("Native Type : " + map.NativeType);
    Console.WriteLine("System Type : " + map.SystemType);
    Console.WriteLine("---------------------------------");
    }

    Here is the output:

     

    Code:
    PropertyName: EmployeeID
    ColumnName : EmployeeID
    CharLength : 0
    Native Type : int
    System Type : System.Int32
    ---------------------------------
    PropertyName: LastName
    ColumnName : LastName
    CharLength : 20
    Native Type : nvarchar
    System Type : System.String
    ---------------------------------
    PropertyName: FirstName
    ColumnName : FirstName
    CharLength : 10
    Native Type : nvarchar
    System Type : System.String
    ---------------------------------
    PropertyName: Title
    ColumnName : Title
    CharLength : 30
    Native Type : nvarchar
    System Type : System.String
    ---------------------------------
    PropertyName: TitleOfCourtesy
    ColumnName : TitleOfCourtesy
    CharLength : 25
    Native Type : nvarchar
    System Type : System.String
    ---------------------------------
    PropertyName: BirthDate
    ColumnName : BirthDate
    CharLength : 0
    Native Type : datetime
    System Type : System.DateTime
    ---------------------------------

     

    The EntitySpaces API help is online and installs on your computer with the Trial. See the help on the classes used above. There are many other properties available to you via the esColumnMetadata class.

View as RSS news feed in XML