Class DataObjectExtensions
IDataObject extension functions
Inherited Members
Namespace: XData
Assembly: XData.docfx.dll
Syntax
public static class DataObjectExtensions
Fields
| Improve this Doc View SourceSubquerySources
Data sources types interpretable as sub queries
Declaration
public static readonly DataSourceType[] SubquerySources
Field Value
Type | Description |
---|---|
DataSourceType[] |
Methods
| Improve this Doc View SourceApply<T>(IRepository<T>, T, String[])
Find object and apply changes from detached object
Declaration
public static T Apply<T>(this IRepository<T> repository, T source, params string[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | repository | Repository |
T | source | Source detached object |
String[] | properties | Properties to copy |
Returns
Type | Description |
---|---|
T | Changed target object |
Type Parameters
Name | Description |
---|---|
T | Object type |
Apply<T>(IRepository<T>, T, ApplyFlag, String[])
Find object and apply changes from detached object
Declaration
public static T Apply<T>(this IRepository<T> repository, T source, ApplyFlag flags, params string[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | repository | Repository |
T | source | Source detached object |
ApplyFlag | flags | Apply behaviour flags |
String[] | properties | Properties to copy |
Returns
Type | Description |
---|---|
T | Changed target object |
Type Parameters
Name | Description |
---|---|
T | Object type |
AssignProperty<T, TValue>(T, String, TValue)
Assign property value
Declaration
public static bool AssignProperty<T, TValue>(this T obj, string prop, TValue value)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | prop | Property name |
TValue | value | Property value |
Returns
Type | Description |
---|---|
Boolean | Property value changed |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TValue | Data property type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name can not be null or empty |
AsString<T>(IQueryable<T>)
Repository select query text
Declaration
public static string AsString<T>(this IQueryable<T> queryable)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | queryable | Queryable source of data object |
Returns
Type | Description |
---|---|
String | Repository |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
WARNING! High resource utilization! Use it for debug only!
Callback<T>(T, String, ref Byte[])
Callback to client
Declaration
public static bool Callback<T>(this T obj, string message, ref byte[] data)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object context |
String | message | Message name |
Byte[] | data | Data to post |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
T | Data object type |
CheckState<T>(T, DataObjectState)
Checks object for state
Declaration
public static bool CheckState<T>(this T obj, DataObjectState state)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
DataObjectState | state | State |
Returns
Type | Description |
---|---|
Boolean | Object has desired state flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | No state attached to object |
See Also
| Improve this Doc View SourceCopy<T>(T, T, String[])
Copy detached object info
Declaration
public static T Copy<T>(this T target, T source, params string[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | target | Target object attached to repository |
T | source | Source detached object |
String[] | properties | Properties to copy |
Returns
Type | Description |
---|---|
T | Changed target object |
Type Parameters
Name | Description |
---|---|
T | Object type |
Copy<T>(T, T, ApplyFlag, String[])
Copy detached object info
Declaration
public static T Copy<T>(this T target, T source, ApplyFlag flags, params string[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | target | Target object attached to repository |
T | source | Source detached object |
ApplyFlag | flags | Apply behaviour flags |
String[] | properties | Properties to copy |
Returns
Type | Description |
---|---|
T | Changed target object |
Type Parameters
Name | Description |
---|---|
T | Object type |
Execute<T>(T, Expression<Func<CustomLogic<T>>>, IDictionary<String, Action<Byte[]>>, IDictionary<String, Func<Byte[], Byte[]>>)
Run custom logic over single object
Declaration
public static bool Execute<T>(this T obj, Expression<Func<CustomLogic<T>>> routine, IDictionary<string, Action<byte[]>> post = null, IDictionary<string, Func<byte[], byte[]>> callback = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<CustomLogic<T>>> | routine | Action field name expression |
IDictionary<String, Action<Byte[]>> | post | Post data handler |
IDictionary<String, Func<Byte[], Byte[]>> | callback | Callback handler |
Returns
Type | Description |
---|---|
Boolean | Success flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: When using XData application server custom logic will executed on server side
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Action field expression is null |
XDataRuntimeException | CustomActionAttribute not found for expression specified field |
See Also
| Improve this Doc View SourceExecute<T>(T, String, IDictionary<String, Action<Byte[]>>, IDictionary<String, Func<Byte[], Byte[]>>)
Run custom logic over single object
Declaration
public static bool Execute<T>(this T obj, string key, IDictionary<string, Action<byte[]>> post = null, IDictionary<string, Func<byte[], byte[]>> callback = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | key | Action key |
IDictionary<String, Action<Byte[]>> | post | Post data handler |
IDictionary<String, Func<Byte[], Byte[]>> | callback | Callback handler |
Returns
Type | Description |
---|---|
Boolean | Success flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: When using XData application server custom logic will executed on server side
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Object repository is detached |
See Also
| Improve this Doc View SourceExecute<T>(ICollection<T>, Expression<Func<CustomLogic<T>>>, IDictionary<String, Action<Byte[]>>, IDictionary<String, Func<Byte[], Byte[]>>)
Run custom logic over array of objects
Declaration
public static bool Execute<T>(this ICollection<T> objects, Expression<Func<CustomLogic<T>>> routine, IDictionary<string, Action<byte[]>> post = null, IDictionary<string, Func<byte[], byte[]>> callback = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | objects | Collection of objects |
Expression<Func<CustomLogic<T>>> | routine | Action field name expression |
IDictionary<String, Action<Byte[]>> | post | Post data handler |
IDictionary<String, Func<Byte[], Byte[]>> | callback | Callback handler |
Returns
Type | Description |
---|---|
Boolean | Success flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: When using XData application server custom logic will executed on server side
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Action field name expression is null |
XDataRuntimeException | CustomActionAttribute not found for expression specified field |
See Also
| Improve this Doc View SourceExecute<T>(ICollection<T>, String, IDictionary<String, Action<Byte[]>>, IDictionary<String, Func<Byte[], Byte[]>>)
Run custom logic over array of objects
Declaration
public static bool Execute<T>(this ICollection<T> objects, string key, IDictionary<string, Action<byte[]>> post = null, IDictionary<string, Func<byte[], byte[]>> callback = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | objects | Collection of objects |
String | key | Action key |
IDictionary<String, Action<Byte[]>> | post | Post data handler |
IDictionary<String, Func<Byte[], Byte[]>> | callback | Callback handler |
Returns
Type | Description |
---|---|
Boolean | Success flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: When using XData application server custom logic will executed on server side
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Object repository is detached |
See Also
| Improve this Doc View SourceFind<T>(IRepository<T>, T, Boolean)
Find detached object in repository
Declaration
public static T Find<T>(this IRepository<T> repository, T source, bool ignoreConcurrency = false)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | repository | Repository |
T | source | Detached object |
Boolean | ignoreConcurrency | Find ignore concurrency token value (optional) default = false |
Returns
Type | Description |
---|---|
T | Found object |
Type Parameters
Name | Description |
---|---|
T | Object type |
FindMemberExpression(Expression)
Property name expression parse helper
Declaration
public static MemberExpression FindMemberExpression(Expression e)
Parameters
Type | Name | Description |
---|---|---|
Expression | e | Property name expression: x => x.SomePropertyName |
Returns
Type | Description |
---|---|
MemberExpression | Property name |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name expression can not be null |
XDataRuntimeException | Expression has a wrong expression type |
GetContext(IDataObject)
Returns context name for object
Declaration
public static string GetContext(this IDataObject obj)
Parameters
Type | Name | Description |
---|---|---|
IDataObject | obj | Data object |
Returns
Type | Description |
---|---|
String | Context name |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException |
GetLayer(IDataObject)
Returns repository layer for object
Declaration
public static Guid GetLayer(this IDataObject obj)
Parameters
Type | Name | Description |
---|---|---|
IDataObject | obj | Data object |
Returns
Type | Description |
---|---|
Guid | Repository layer |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException |
GetParameter<T>(IDataQuery, String)
Returns SQL procedure/function out parameter value
Declaration
public static T GetParameter<T>(this IDataQuery query, string param)
Parameters
Type | Name | Description |
---|---|---|
IDataQuery | query | Data query |
String | param | Parameter name |
Returns
Type | Description |
---|---|
T | Parameter value |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Parameter name can not be null or empty |
See Also
| Improve this Doc View SourceGetParameter<T, TRet>(T, Expression<Func<T, TRet>>)
Returns SQL procedure/function out parameter value
Declaration
public static TRet GetParameter<T, TRet>(this T obj, Expression<Func<T, TRet>> param)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, TRet>> | param | Parameter name expression using same name property (case insensitive) |
Returns
Type | Description |
---|---|
TRet | Parameter value |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRet | Parameter type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Parameter name expression can not be null |
GetParameter<T, TRet>(T, String)
Returns SQL procedure/function out parameter value
Declaration
public static TRet GetParameter<T, TRet>(this T obj, string param)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | param | Parameter name |
Returns
Type | Description |
---|---|
TRet | Parameter value |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRet | Parameter type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Parameter name can not be null or empty |
See Also
| Improve this Doc View SourceGetParameter<T, TRet>(IDataQuery<T>, Expression<Func<T, TRet>>)
Returns SQL procedure/function out parameter value
Declaration
public static TRet GetParameter<T, TRet>(this IDataQuery<T> query, Expression<Func<T, TRet>> param)
where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
IDataQuery<T> | query | Data query |
Expression<Func<T, TRet>> | param | Parameter name expression using same name property (case insensitive) |
Returns
Type | Description |
---|---|
TRet | Parameter value |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRet | Parameter type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Parameter name expression can not be null |
GetProperties<T>(T, IEnumerable<String>, DataVersion)
Returns properties values
Declaration
public static IEnumerable<KeyValuePair<string, object>> GetProperties<T>(this T obj, IEnumerable<string> props, DataVersion version = DataVersion.Actual)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
IEnumerable<String> | props | Properties sequence |
DataVersion | version | Data version |
Returns
Type | Description |
---|---|
IEnumerable<KeyValuePair<String, Object>> | Sequence of name value pairs |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: To get a single property value use GetProperty<T, TRet>(T, Expression<Func<T, TRet>>, DataVersion) function.
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Properties sequence is null |
GetProperties<T>(T, String[])
Returns properties values
Hint: To get a single property value use GetProperty function.
Declaration
public static IEnumerable<KeyValuePair<string, object>> GetProperties<T>(this T obj, params string[] props)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String[] | props | Properties array |
Returns
Type | Description |
---|---|
IEnumerable<KeyValuePair<String, Object>> | Sequence of name value pairs |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: To get a single property value use GetProperty<T, TRet>(T, Expression<Func<T, TRet>>, DataVersion) function.
GetProperties<T>(T, DataVersion, String[])
Returns properties values
Declaration
public static IEnumerable<KeyValuePair<string, object>> GetProperties<T>(this T obj, DataVersion version = DataVersion.Actual, params string[] props)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
DataVersion | version | Data version |
String[] | props | Properties array |
Returns
Type | Description |
---|---|
IEnumerable<KeyValuePair<String, Object>> | Sequence of name value pairs |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Remarks
Hint: To get a single property value use GetProperty<T, TRet>(T, Expression<Func<T, TRet>>, DataVersion) function.
GetProperty<TRet>(IDataObject, String)
Returns single property value
Declaration
public static TRet GetProperty<TRet>(this IDataObject obj, string prop)
Parameters
Type | Name | Description |
---|---|---|
IDataObject | obj | Data object instance |
String | prop | Property name |
Returns
Type | Description |
---|---|
TRet | Property value |
Type Parameters
Name | Description |
---|---|
TRet | Property type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name can not be null or empty |
See Also
| Improve this Doc View SourceGetProperty<T, TRet>(T, Expression<Func<T, TRet>>)
Returns property value
Declaration
public static TRet GetProperty<T, TRet>(this T obj, Expression<Func<T, TRet>> prop)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, TRet>> | prop | Property name expression: x => x.SomePropertyName |
Returns
Type | Description |
---|---|
TRet | Property value |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRet | Property type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name expression can not be null |
GetProperty<T, TRet>(T, Expression<Func<T, TRet>>, DataVersion)
Returns property value
Declaration
public static TRet GetProperty<T, TRet>(this T obj, Expression<Func<T, TRet>> prop, DataVersion version)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, TRet>> | prop | Property name expression: x => x.SomePropertyName |
DataVersion | version | Data version |
Returns
Type | Description |
---|---|
TRet | Property value |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRet | Property type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name expression can not be null |
GetRepository<T>(T)
Returns object repository
Declaration
public static IRepository<T> GetRepository<T>(this T obj)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Returns
Type | Description |
---|---|
IRepository<T> | Object repository |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Object repository is detached |
GetRepositoryAlias(IDataObject)
Returns object's repository alias
Declaration
public static string GetRepositoryAlias(this IDataObject obj)
Parameters
Type | Name | Description |
---|---|---|
IDataObject | obj | Data object |
Returns
Type | Description |
---|---|
String | Repository alias |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException |
GetResultSet<TRes>(IDataQuery, Expression<Func<IEnumerable<TRes>>>)
Returns SQL procedure/function result set
Declaration
public static IEnumerable<TRes> GetResultSet<TRes>(this IDataQuery query, Expression<Func<IEnumerable<TRes>>> resultSetName)
where TRes : class
Parameters
Type | Name | Description |
---|---|---|
IDataQuery | query | Data query |
Expression<Func<IEnumerable<TRes>>> | resultSetName | Result set name expression using same name property (case insensitive) |
Returns
Type | Description |
---|---|
IEnumerable<TRes> | Result set object sequence |
Type Parameters
Name | Description |
---|---|
TRes | Result set object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Result set name expression can not be null |
See Also
| Improve this Doc View SourceGetResultSet<TRes>(IDataQuery, String)
Returns SQL procedure/function result set
Declaration
public static IEnumerable<TRes> GetResultSet<TRes>(this IDataQuery query, string resultSetName)
where TRes : class
Parameters
Type | Name | Description |
---|---|---|
IDataQuery | query | Data query |
String | resultSetName | Result set name name |
Returns
Type | Description |
---|---|
IEnumerable<TRes> | Parameter value |
Type Parameters
Name | Description |
---|---|
TRes | Result set object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Result set name can not be null or empty |
See Also
| Improve this Doc View SourceGetResultSet<T, TRes>(T, Expression<Func<T, IEnumerable<TRes>>>)
Returns SQL procedure/function result set
Declaration
public static IEnumerable<TRes> GetResultSet<T, TRes>(this T obj, Expression<Func<T, IEnumerable<TRes>>> resultSetName)
where T : class, IDataObject, new()
where TRes : class
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, IEnumerable<TRes>>> | resultSetName | Result set name expression using same name property (case insensitive) |
Returns
Type | Description |
---|---|
IEnumerable<TRes> | Result set object sequence |
Type Parameters
Name | Description |
---|---|
T | Data object type |
TRes | Result set object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Result set name expression can not be null |
GetResultSet<T, TRes>(IRepository<T>, Expression<Func<T, IEnumerable<TRes>>>)
Returns SQL procedure/function result set
Declaration
public static IEnumerable<TRes> GetResultSet<T, TRes>(this IRepository<T> repository, Expression<Func<T, IEnumerable<TRes>>> resultSetName)
where T : class, IDataObject, new()
where TRes : class
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | repository | Data object repository |
Expression<Func<T, IEnumerable<TRes>>> | resultSetName | Result set name expression using same name property (case insensitive) |
Returns
Type | Description |
---|---|
IEnumerable<TRes> | Result set object sequence |
Type Parameters
Name | Description |
---|---|
T | Object type |
TRes | Result set object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Result set name expression can not be null |
See Also
| Improve this Doc View SourceGetState<T>(T)
Returns state of object
Declaration
public static DataObjectState GetState<T>(this T obj)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Returns
Type | Description |
---|---|
DataObjectState | Object state flags combination(see DataObjectState) |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | No state attached to object |
See Also
| Improve this Doc View SourceIsAttached(IDataObject, Type)
Check data object is attached
Declaration
public static bool IsAttached(this IDataObject obj, Type type)
Parameters
Type | Name | Description |
---|---|---|
IDataObject | obj | Data object instance |
Type | type | Data object type |
Returns
Type | Description |
---|---|
Boolean | Object is attached |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Object is detached |
IsChanged<T>(T, Expression<Func<T, Object>>[])
Test property value is assigned
Declaration
public static bool IsChanged<T>(this T obj, params Expression<Func<T, object>>[] prop)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, Object>>[] | prop | Property name expression |
Returns
Type | Description |
---|---|
Boolean | Property is changed |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name expression can not be null |
IsChanged<T>(T, String)
Test property value is assigned
Declaration
public static bool IsChanged<T>(this T obj, string prop)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | prop | Property name |
Returns
Type | Description |
---|---|
Boolean | Property is changed |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name can not be null or empty |
IsCleared<T>(T, String)
Test property value is cleared
Declaration
public static bool IsCleared<T>(this T obj, string prop)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | prop | Property name |
Returns
Type | Description |
---|---|
Boolean | Property is cleared |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name can not be null or empty |
IsEmpty<T>(T, Expression<Func<T, Object>>)
Test property value is empty
Declaration
public static bool IsEmpty<T>(this T obj, Expression<Func<T, object>> prop)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Expression<Func<T, Object>> | prop | Property name expression |
Returns
Type | Description |
---|---|
Boolean | Property is empty |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name expression can not be null |
IsEmpty<T>(T, String)
Test property value is empty
Declaration
public static bool IsEmpty<T>(this T obj, string prop)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
String | prop | Property name |
Returns
Type | Description |
---|---|
Boolean | Property is empty |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Property name can not be null or empty |
LoadLob<T>(T)
Load Lob and Xml field values of data object
Declaration
public static T LoadLob<T>(this T obj)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object |
Returns
Type | Description |
---|---|
T | Enriched object |
Type Parameters
Name | Description |
---|---|
T | Object type |
LoadLob<T>(T, Expression<Func<T, Object>>[])
Load Lob and Xml field values of data object
Declaration
public static T LoadLob<T>(this T obj, params Expression<Func<T, object>>[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object |
Expression<Func<T, Object>>[] | properties | Properties expressions |
Returns
Type | Description |
---|---|
T | Enriched object |
Type Parameters
Name | Description |
---|---|
T | Object type |
LoadLob<T>(T, String[])
Load Lob and Xml field values of data object
Declaration
public static T LoadLob<T>(this T obj, params string[] properties)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object |
String[] | properties | Properties extensions |
Returns
Type | Description |
---|---|
T | Enriched object |
Type Parameters
Name | Description |
---|---|
T | Object type |
Lock<T>(T)
Lock object in database
Declaration
public static bool Lock<T>(this T obj)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Returns
Type | Description |
---|---|
Boolean | Lock success |
Type Parameters
Name | Description |
---|---|
T | Data object type |
See Also
| Improve this Doc View SourceModify(Lob, Action<Byte[]>)
Lob field modify
Declaration
public static Lob Modify(this Lob source, Action<byte[]> action)
Parameters
Type | Name | Description |
---|---|---|
Lob | source | Source Lob |
Action<Byte[]> | action | Modify action |
Returns
Type | Description |
---|---|
Lob | Modified Lob |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Modify logic error |
See Also
| Improve this Doc View SourceModify(Xml, Action<XDocument>)
Xml field modify
Declaration
public static Xml Modify(this Xml source, Action<XDocument> action)
Parameters
Type | Name | Description |
---|---|---|
Xml | source | Source document |
Action<XDocument> | action | Modify action |
Returns
Type | Description |
---|---|
Xml | Modified xml |
Examples
invoice.Source.Modify(doc => doc.Element("invoice").Attribute("state").Value = "ACTIVE");
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | Modify logic error |
See Also
| Improve this Doc View SourceModify<T>(T, Action<T>[])
Data object modification wrapper
Declaration
public static T Modify<T>(this T obj, params Action<T>[] actions)
where T : class, IDataObject
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object |
Action<T>[] | actions | Modification actions |
Returns
Type | Description |
---|---|
T | Modified data object |
Type Parameters
Name | Description |
---|---|
T | Data object type |
PostData<T>(T, String, Func<Byte[]>)
Post data to client
Declaration
public static void PostData<T>(this T obj, string message, Func<byte[]> data)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object context |
String | message | Message name |
Func<Byte[]> | data | Data to post |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Refresh<T>(T)
Refresh single data object from database
Declaration
public static bool Refresh<T>(this T obj)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Returns
Type | Description |
---|---|
Boolean | Success flag |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Refresh<T>(IRepository<T>)
Refresh repository data
Declaration
public static IRepository<T> Refresh<T>(this IRepository<T> source)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | source | Repository |
Returns
Type | Description |
---|---|
IRepository<T> | Repository |
Type Parameters
Name | Description |
---|---|
T | Data object type |
SetAttachedHandlers<T>(T, AttachedHandler<T>[])
Attach extra handlers to object instance
Declaration
public static void SetAttachedHandlers<T>(this T obj, params AttachedHandler<T>[] handlers)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
AttachedHandler<T>[] | handlers | Handlers |
Type Parameters
Name | Description |
---|---|
T | Data object type |
SetCurrent<T>(T)
Set object as repository current
Declaration
public static void SetCurrent<T>(this T obj)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Type Parameters
Name | Description |
---|---|
T | Data object type |
See Also
| Improve this Doc View SourceSetDeleted<T>(T, Boolean)
Set deleted state to object
Declaration
public static T SetDeleted<T>(this T obj, bool setState)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Boolean | setState | Set or remove DataObjectState.Deleted state flag |
Returns
Type | Description |
---|---|
T | Object marked as deleted/restored |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | No state attached to object |
See Also
| Improve this Doc View SourceSetDeleted<T>(ICollection<T>, Boolean)
Set deleted state to each object in collection
Declaration
public static ICollection<T> SetDeleted<T>(this ICollection<T> collection, bool setState)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | collection | Data object collection |
Boolean | setState | Set or remove DataObjectState.Deleted state flag |
Returns
Type | Description |
---|---|
ICollection<T> | Collection of objects marked as deleted/restored |
Type Parameters
Name | Description |
---|---|
T | Data object type |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | No state attached to object |
See Also
| Improve this Doc View SourceSetFilterValue<T, TRes>(IRepository<T>, Expression<Func<T, TRes>>, TRes)
Set value to dynamically created runtime filter
Declaration
public static IRepository<T> SetFilterValue<T, TRes>(this IRepository<T> repository, Expression<Func<T, TRes>> propertyExpression, TRes filterValue)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<T> | repository | Repository |
Expression<Func<T, TRes>> | propertyExpression | Property name expression |
TRes | filterValue | Filter value |
Returns
Type | Description |
---|---|
IRepository<T> | Repository |
Type Parameters
Name | Description |
---|---|
T | Repository data object type |
TRes | Property type |
SetVar<T>(String, T)
Set variable value
Declaration
public static Variable SetVar<T>(this string name, T value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Variable name |
T | value | Variable value |
Returns
Type | Description |
---|---|
Variable | Variable |
Type Parameters
Name | Description |
---|---|
T | Value type |
Submit<T>(T, out T, DataSubmitFlag)
Submit data object changes
Declaration
public static bool Submit<T>(this T obj, out T res, DataSubmitFlag flag = DataSubmitFlag.None)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
T | res | Submitted object |
DataSubmitFlag | flag | Submit flag |
Returns
Type | Description |
---|---|
Boolean | Submit success |
Type Parameters
Name | Description |
---|---|
T | Data object type |
See Also
| Improve this Doc View SourceSubmit<T>(T, Func<JsonSettings<T>, JsonSettings<T>>, out T, DataSubmitFlag)
Submit data object changes
Declaration
public static bool Submit<T>(this T obj, Func<JsonSettings<T>, JsonSettings<T>> settings, out T res, DataSubmitFlag flag = DataSubmitFlag.None)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
Func<JsonSettings<T>, JsonSettings<T>> | settings | JSON serialization settings |
T | res | Submitted object |
DataSubmitFlag | flag | Submit flag |
Returns
Type | Description |
---|---|
Boolean | Submit success |
Type Parameters
Name | Description |
---|---|
T | Data object type |
See Also
| Improve this Doc View SourceSubmit<T>(T, DataSubmitFlag)
Submit data object changes
Declaration
public static bool Submit<T>(this T obj, DataSubmitFlag flag = DataSubmitFlag.None)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Data object instance |
DataSubmitFlag | flag | Submit flag |
Returns
Type | Description |
---|---|
Boolean | Submit success |
Type Parameters
Name | Description |
---|---|
T | Data object type |
See Also
| Improve this Doc View SourceToArray<T>(IEnumerable<T>, Func<JsonSettings<T>, JsonSettings<T>>)
Returns array of data objects with JSON serialization settings applied
Declaration
public static T[] ToArray<T>(this IEnumerable<T> sourceEnumerable, Func<JsonSettings<T>, JsonSettings<T>> settings)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | sourceEnumerable | Source object sequence |
Func<JsonSettings<T>, JsonSettings<T>> | settings | JSON serialization settings |
Returns
Type | Description |
---|---|
T[] | Array of data objects with JSON serialization settings applied |
Type Parameters
Name | Description |
---|---|
T | Object type |
WithJsonSettings<T>(T, Func<JsonSettings<T>, JsonSettings<T>>)
Apply custom JSON serialization settings to single object
Declaration
public static T WithJsonSettings<T>(this T obj, Func<JsonSettings<T>, JsonSettings<T>> settings)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object to apply serialization settings |
Func<JsonSettings<T>, JsonSettings<T>> | settings | Serialization settings fill routine |
Returns
Type | Description |
---|---|
T | Object with custom serialization settings |
Type Parameters
Name | Description |
---|---|
T | ObjectType |
WithJsonSettings<T>(ICollection<T>, Func<JsonSettings<T>, JsonSettings<T>>)
Apply custom JSON serialization settings to collection
Declaration
public static ICollection<T> WithJsonSettings<T>(this ICollection<T> collection, Func<JsonSettings<T>, JsonSettings<T>> settings)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | collection | Collection to apply serialization settings |
Func<JsonSettings<T>, JsonSettings<T>> | settings | Serialization settings fill routine |
Returns
Type | Description |
---|---|
ICollection<T> | Collection with custom serialization settings |
Type Parameters
Name | Description |
---|---|
T | ObjectType |