Welcome to Rainbow Portal Community Sign in | Join | Help

Custom Build Provider

In a lesson from the great developer fredrik norman i explored build providers, cool stuff code generation. So, i created an enumGenerator. that builds enum code based on an xml type file.

<enumGenerator>

<namespace>Rainbow.Framework</namespace>

<enums>

<enum name='Roles' type='System.String'>

<item name=it_eCommerce' value='*IT ecommerce' />

<item name='it_help' value='*IT Help' />

<item name='it_security' value='*IT Security' />

</enum>

</enums>

</enumGenerator>

 

very cool stuff, with enourmous potential build providers.

here is a sample class generated using codedom against a table in the content api, to generate objects agianst the databse tables.

 

 

   1:  public class Item {
   2:          
   3:          private long _ItemId;
   4:          
   5:          private long _ItemMasterID;
   6:          
   7:          private int _ItemTypeId;
   8:          
   9:          private string _culturename;
  10:          
  11:          private string _Title;
  12:          
  13:          private bool _IsStoredInDb;
  14:          
  15:          private long _Version;
  16:          
  17:          private bool _IsEncrypted;
  18:          
  19:          public virtual long ItemId {
  20:              get {
  21:                  return this._ItemId;
  22:              }
  23:              set {
  24:                  this._ItemId = value;
  25:              }
  26:          }
  27:          
  28:          public virtual long ItemMasterID {
  29:              get {
  30:                  return this._ItemMasterID;
  31:              }
  32:              set {
  33:                  this._ItemMasterID = value;
  34:              }
  35:          }
  36:          
  37:          public virtual int ItemTypeId {
  38:              get {
  39:                  return this._ItemTypeId;
  40:              }
  41:              set {
  42:                  this._ItemTypeId = value;
  43:              }
  44:          }
  45:          
  46:          public virtual string Culturename {
  47:              get {
  48:                  return this._culturename;
  49:              }
  50:              set {
  51:                  this._culturename = value;
  52:              }
  53:          }
  54:          
  55:          public virtual string Title {
  56:              get {
  57:                  return this._Title;
  58:              }
  59:              set {
  60:                  this._Title = value;
  61:              }
  62:          }
  63:          
  64:          public virtual bool IsStoredInDb {
  65:              get {
  66:                  return this._IsStoredInDb;
  67:              }
  68:              set {
  69:                  this._IsStoredInDb = value;
  70:              }
  71:          }
  72:          
  73:          public virtual long Version {
  74:              get {
  75:                  return this._Version;
  76:              }
  77:              set {
  78:                  this._Version = value;
  79:              }
  80:          }
  81:          
  82:          public virtual bool IsEncrypted {
  83:              get {
  84:                  return this._IsEncrypted;
  85:              }
  86:              set {
  87:                  this._IsEncrypted = value;
  88:              }
  89:          }
  90:      }
Published lunedì 1 maggio 2006 2.57 by Jonathan

Comments

No Comments

Anonymous comments are disabled