Interface ISchemaDataObject
- Namespace
- OrpheusInterfaces.Schema
- Assembly
- OrpheusInterfaces.dll
Base schema data object interface.
public interface ISchemaDataObject : ISchemaObject
- Inherited Members
Properties
Constraints
List of schema object constraints. Primary,foreign or any type of constraint.
List<ISchemaConstraint> Constraints { get; set; }
Property Value
- List<ISchemaConstraint>
Constraints in the schema object
DB
Orpheus database.
IOrpheusDatabase DB { get; }
Property Value
- IOrpheusDatabase
Database where the schema object exists
Fields
Fields for the schema object. Applicable mostly when schema object is a table or a view.
List<ISchemaField> Fields { get; set; }
Property Value
- List<ISchemaField>
Fields in the schema object
Methods
AddField(string, string, bool, string, string, string)
Creates and adds a field to the field list.
ISchemaField AddField(string name, string dataType, bool nullable = true, string defaultValue = null, string size = null, string alias = null)
Parameters
namestringField name
dataTypestringField data type
nullableboolNullable
defaultValuestringField default value
sizestringField size
aliasstringField alias
Returns
AddForeignKeyConstraint(string, List<string>, string, List<string>, bool, bool)
Adds a foreign key constraint.
IForeignKeySchemaConstraint AddForeignKeyConstraint(string name, List<string> fields, string foreignKeySchemaObject, List<string> foreignKeySchemaFields, bool onCascadeDelete = true, bool onUpdateDelete = true)
Parameters
namestringConstraint name
fieldsList<string>Constraint fields
foreignKeySchemaObjectstringReference table name
foreignKeySchemaFieldsList<string>Reference table fields
onCascadeDeleteboolCascade on delete
onUpdateDeleteboolCascade on update
Returns
AddPrimaryKeyConstraint(string, List<string>, SchemaSort)
Adds a primary key constraint.
IPrimaryKeySchemaConstraint AddPrimaryKeyConstraint(string name, List<string> fields, SchemaSort sort = SchemaSort.ssAsc)
Parameters
namestringConstraint name
fieldsList<string>Constraint fields
sortSchemaSortConstraint sort
Returns
AddUniqueKeyConstraint(string, List<string>)
Adds a unique key constraint.
IUniqueKeySchemaConstraint AddUniqueKeyConstraint(string name, List<string> fields)
Parameters
Returns
- IUniqueKeySchemaConstraint
An IUniqueKeySchemaConstraint
CreateFieldsFromModel(object)
Creates fields from a given model. Supports OrpheusAttributes attributes
Instance of modelvoid CreateFieldsFromModel(object model)
Parameters
modelobject
CreateFieldsFromModel(Type)
Creates fields from a given model. Supports OrpheusAttributes attributes
Model typevoid CreateFieldsFromModel(Type modelType)
Parameters
modelTypeType
CreateFieldsFromModel<T>()
Creates fields from a given model. Supports OrpheusAttributes attributes
void CreateFieldsFromModel<T>()
Type Parameters
TModel type
GetConstraintsDDL()
Returns the DDL constraints string to be executed.
List<string> GetConstraintsDDL()
Returns
GetData<T>()
Returns the seed data for the table if defined.
List<T> GetData<T>()
Returns
- List<T>
Schema object's data
Type Parameters
TSchema object model type
SetData<T>(List<T>)
Optional data to initialize a schema object. Practically applicable only to a table.
void SetData<T>(List<T> data)
Parameters
dataList<T>
Type Parameters
T