A simple class structure

The following is an example of a Simple Class Structure for reading row from table:

  CREATE TABLE[dbo].[DbAdapterTest]
  (
     [Id][INT] NOT NULL,
     [LastName] [VARCHAR] (50) NOT NULL,
     [FirstName] [VARCHAR] (50) NOT NULL
  ) 

The best way to create the structure is to use Type libraries, create a type using “database adapter object” and then define the structure: In the example 'Item' is supposed to take the data from the table 'DbAdapterTest'.

If the field name differs from the column name of the table, then the public name must also be assigned here. In the example here the field 'Name' has the public name 'LastName'. The template for the type can be found under

As C# code:

 public class DbAdapterSample : IDbMapObjectRoot
    {
        [MapExternalName("DbAdapterTest"), MapTrigger]
        public List<DbAdapterSampleItems> Items;
 
    }
 
    public class DbAdapterSampleItems : IMapObjectItem
    {
        public int Id;
 
        [MapExternalName("LastName")]
        public string Name;
 
        public string FirstName;
    }