This project is read-only.
Quickstart:

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.

Reference:
string object.CreateSchema()

alt.

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:
Customer.CreateSchema();
PurchaseOrder.CreateSchema(new GenerateProperties(IncludeFields: true));

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

Comments

nautilus Oct 1, 2013 at 4: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 3:59 PM 
.CreateSchema doesn't get any parameter, i'm missing something?

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

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