IDataLayer.SchemaInit Event
When implemented by a class, this event will occur when the data schema is initialized or updated.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
Declaration
Event Data
The SchemaInit event's data class is SchemaInitEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Command | Gets an SQL statement which can be executed while connected to an SQL data source. |
Table | Gets an object metadata the schema for which has been created in storage. |
Remarks
private static void DataLayer_SchemaInit(object sender, SchemaInitEventArgs e) {
if (e.Table.ClassType == typeof(User)) {
XPMemberInfo firstNameColumn = e.Table.FindMember("FirstName");
e.Command.CommandText = String.Format(
"alter table [{0}] alter column [{1}] nvarchar({2}) collate Latin1_General_CS_AS",
e.Table.TableName, firstNameColumn.MappingField, firstNameColumn.MappingFieldSize
);
e.Command.ExecuteNonQuery();
}
}
See Also