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));