Class AutoDataSetExtensions
- Namespace
- BpNexT.NET.Extensions
- Assembly
- BpNexT.NET.dll
Provides extension methods for the AutoDataSet class.
public static class AutoDataSetExtensions
- Inheritance
-
objectAutoDataSetExtensions
Methods
As<T>(AutoDataSet, Guid, AutoDataSet?, string[]?, IHasNestedDataSets?)
Converts an AutoDataSet to an instance of type T.
public static T As<T>(this AutoDataSet dataSet, Guid applicationInstanceId, AutoDataSet? parentDataSet = null, string[]? includes = null, IHasNestedDataSets? parentObject = null) where T : IHasAutoDataSet, new()
Parameters
dataSetAutoDataSetThe AutoDataSet to convert.
applicationInstanceIdGuidThe instance ID
parentDataSetAutoDataSetThe parent AutoDataSet, for NestedDataSets.
includesstring[]Optional properties to include in the conversion.
parentObjectIHasNestedDataSetsThe parent object that contains the AutoDataSet, if applicable.
Returns
- T
An instance of type T with properties populated from the AutoDataSet.
Type Parameters
TThe type to convert to, which must inherit from HasAutoDataSet and have a parameterless constructor.
FillFrom<T>(AutoDataSet, T)
Fills empty properties from another instance of HasAutoDataSet.
public static void FillFrom<T>(this AutoDataSet dataSet, T other) where T : IHasAutoDataSet
Parameters
dataSetAutoDataSetThe AutoDataSet to fill to.
otherTThe other instance to copy from.
Type Parameters
TThe type of the other instance.
Exceptions
- ArgumentException
Thrown when the type of the other instance does not match the current type.
GetDataSet<T>(AutoDataSet, string?)
Retrieves a dataset of the specified type with an optional filter.
public static FilterableDataSet<T> GetDataSet<T>(this AutoDataSet dataSet, string? filter = null) where T : IHasAutoDataSet, new()
Parameters
dataSetAutoDataSetThe dataset to retrieve data from.
filterstringOptional filter to apply to the dataset.
Returns
- FilterableDataSet<T>
An enumerable collection of the specified type.
Type Parameters
TThe type of the dataset.
GetIdentifier(AutoDataSet?, AutoDataSet?)
Gets a unique identifier (within it's set) for the AutoDataSet.
public static string GetIdentifier(this AutoDataSet? dataSet, AutoDataSet? parentDataSet = null)
Parameters
dataSetAutoDataSetparentDataSetAutoDataSet
Returns
GetIdentifier<T>(T?, object?)
Gets a unique identifier (within its set) for the AutoDataSet.
public static string GetIdentifier<T>(this T? dataSet, object? parentDataSet = null) where T : IHasAutoDataSet
Parameters
dataSetTparentDataSetobject
Returns
Type Parameters
T
ParseSelektionsFelder(AutoDataSet)
Parses the SelektionsFelder of an AutoDataSet.
public static List<SelektionsFeld> ParseSelektionsFelder(this AutoDataSet autoDataSet)
Parameters
autoDataSetAutoDataSetThe AutoDataSet to parse SelektionsFelder for
Returns
- List<SelektionsFeld>
A list of SelektionsFelder
Save<T>(AutoDataSet, T, string[]?)
Saves the properties of an object to the corresponding AutoDataSet.
public static void Save<T>(this AutoDataSet dataSet, T obj, string[]? toMapValues = null)
Parameters
dataSetAutoDataSetThe AutoDataSet to save to.
objTThe object to save.
toMapValuesstring[]An optional array of property names to map values for.
Type Parameters
TThe type of the object to save.
TryPost(AutoDataSet)
Attempts to post the AutoDataSet.
public static bool TryPost(this AutoDataSet autoDataSet)
Parameters
autoDataSetAutoDataSetThe AutoDataSet to post.
Returns
- bool
True if the post was successful, otherwise false.