1. Make a reference to ObjectScriptingExtensions.DLL

2. Add a using statement to the code like:
using ObjectScriptingExtensions;

3. Use the .CreateSchema-extension on any object.

string object.CreateSchema()


string object.CreateSchema(GenerateProperties settings)

The GenerateProperties object has the following members:
  • string LookupPrefix (default "")
  • string TablePrefix (default "" )
  • string SchemaName (default "dbo")
  • string IdName (default "ID")
  • string FkPrefix (default "FK_" prefix på foreign key-kolumner)
  • IdTypes IdType (default IdTypes.Identity) Possible values : IdTypes.Identity or IdTypes.Guid, gives Table Id type
  • InheritanceStrategy Strategy (default InheritanceStrategy.SplitClassHierarchies) Possible values: InheritanceStrategy.SplitClassHierarchies or InheritanceStrategy.KeepClassHierarchies. How to map class hierarchies to table, SplitClassHierarchies does not include super class members, keep will duplicate data.
  • bool IncludeFields (default false) If this is true then public fields will be table fields as well as the public properties.
  • bool RestrictToAssembly (default false) If set to true this will generate SQL for objects from other assemblies as well.

Example of usage:
PurchaseOrder.CreateSchema(new GenerateProperties(IncludeFields: true));

Last edited Apr 5, 2012 at 4:36 PM by KaiSev, version 1


nautilus Oct 1, 2013 at 3:12 PM 
good tool, saved me time. Could not figure out how to override default varchar length 4000 and how to make ID column optional (i already have id property).

foluis Oct 12, 2012 at 2:59 PM 
.CreateSchema doesn't get any parameter, i'm missing something?

foluis Oct 12, 2012 at 2:57 PM 
How can i get the code?

nubbe Jul 14, 2012 at 8:04 AM 
Thanks for a great tool, it worked perfectly.