Table of Contents

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

name string

Field name

dataType string

Field data type

nullable bool

Nullable

defaultValue string

Field default value

size string

Field size

alias string

Field alias

Returns

ISchemaField

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

name string

Constraint name

fields List<string>

Constraint fields

foreignKeySchemaObject string

Reference table name

foreignKeySchemaFields List<string>

Reference table fields

onCascadeDelete bool

Cascade on delete

onUpdateDelete bool

Cascade on update

Returns

IForeignKeySchemaConstraint

AddPrimaryKeyConstraint(string, List<string>, SchemaSort)

Adds a primary key constraint.

IPrimaryKeySchemaConstraint AddPrimaryKeyConstraint(string name, List<string> fields, SchemaSort sort = SchemaSort.ssAsc)

Parameters

name string

Constraint name

fields List<string>

Constraint fields

sort SchemaSort

Constraint sort

Returns

IPrimaryKeySchemaConstraint

AddUniqueKeyConstraint(string, List<string>)

Adds a unique key constraint.

IUniqueKeySchemaConstraint AddUniqueKeyConstraint(string name, List<string> fields)

Parameters

name string

Constraint name

fields List<string>

Constraint fields

Returns

IUniqueKeySchemaConstraint

An IUniqueKeySchemaConstraint

CreateFieldsFromModel(object)

Creates fields from a given model. Supports OrpheusAttributes attributes

Instance of model
void CreateFieldsFromModel(object model)

Parameters

model object

CreateFieldsFromModel(Type)

Creates fields from a given model. Supports OrpheusAttributes attributes

Model type
void CreateFieldsFromModel(Type modelType)

Parameters

modelType Type

CreateFieldsFromModel<T>()

Creates fields from a given model. Supports OrpheusAttributes attributes

void CreateFieldsFromModel<T>()

Type Parameters

T

Model type

GetConstraintsDDL()

Returns the DDL constraints string to be executed.

List<string> GetConstraintsDDL()

Returns

List<string>

Get the generated DDL string for the schema constraints

GetData<T>()

Returns the seed data for the table if defined.

List<T> GetData<T>()

Returns

List<T>

Schema object's data

Type Parameters

T

Schema 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

data List<T>

Type Parameters

T