Class EnumerableExtensions
Contains extension methods to convert view models and option objects to DynamicList<TViewModel, TOptions>.
Inherited Members
Namespace: DynamicVML.Extensions
Assembly: DynamicVML.dll
Syntax
public static class EnumerableExtensions
Methods
| Improve this Doc View SourceToDynamicList<TViewModel>(TViewModel, String)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel> ToDynamicList<TViewModel>(this TViewModel viewModel, string containerId)
where TViewModel : class
Parameters
Type | Name | Description |
---|---|---|
TViewModel | viewModel | The view model to be wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
Returns
Type | Description |
---|---|
DynamicList<TViewModel> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
ToDynamicList<TViewModel, TOptions>(TViewModel, String, TOptions)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions>(this TViewModel viewModel, string containerId, TOptions options)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
TViewModel | viewModel | The view model to be wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
TOptions | options | The options to be associated with your view model. Note that this
method will set the ViewModel property
of the given |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
ToDynamicList<TViewModel, TOptions>(TViewModel, String, Func<TViewModel, TOptions>)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions>(this TViewModel viewModel, string containerId, Func<TViewModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
TViewModel | viewModel | The view model to be wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
Func<TViewModel, TOptions> | optionsSelector | A function that can be used to define how your view model
should be wrapped in a |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
ToDynamicList<TViewModel, TModel>(TModel, String, Func<TModel, TViewModel>)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel> ToDynamicList<TViewModel, TModel>(this TModel model, string containerId, Func<TModel, TViewModel> viewModelSelector)
where TViewModel : class
Parameters
Type | Name | Description |
---|---|---|
TModel | model | The database model to be converted in a view model and wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
Func<TModel, TViewModel> | viewModelSelector | A function that can be used to define how your view model should be created from your model. |
Returns
Type | Description |
---|---|
DynamicList<TViewModel> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TModel | The type of your (database) model. |
ToDynamicList<TViewModel, TOptions>(IEnumerable<TViewModel>)
Converts a list of TViewModel
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel> ToDynamicList<TViewModel, TOptions>(this IEnumerable<TViewModel> viewModels)
where TViewModel : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TViewModel> | viewModels | The list of viewmodel objects to be wrapped in option objects and then added to the list. |
Returns
Type | Description |
---|---|
DynamicList<TViewModel> | A DynamicList<TViewModel, TOptions> containing the given |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
ToDynamicList<TViewModel, TOptions>(IEnumerable<TViewModel>, Func<TViewModel, TOptions>)
Converts a list of TViewModel
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions>(this IEnumerable<TViewModel> viewModels, Func<TViewModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TViewModel> | viewModels | The list of viewmodel objects to be wrapped in option objects and then added to the list. |
Func<TViewModel, TOptions> | optionsSelector | A function that can be used to configure the |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A DynamicList<TViewModel, TOptions> containing the given |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
ToDynamicList<TViewModel, TOptions>(IEnumerable<TOptions>)
Converts a list of TOptions
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions>(this IEnumerable<TOptions> options)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TOptions> | options | The list of options objects to be added to the list. |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A DynamicList<TViewModel, TOptions> containing the given |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
ToDynamicList<TViewModel, TModel>(IEnumerable<TModel>, Func<TModel, TViewModel>)
Converts a list of TViewModel
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel> ToDynamicList<TViewModel, TModel>(this IEnumerable<TModel> models, Func<TModel, TViewModel> viewModelSelector)
where TViewModel : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TModel> | models | A list of database models to be converted into view models, and then inserted in a dynamic list. |
Func<TModel, TViewModel> | viewModelSelector | A function that can be used to define how your view model should be created from your model. |
Returns
Type | Description |
---|---|
DynamicList<TViewModel> |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view models. |
TModel | The type of your (database) models. |
ToDynamicList<TViewModel, TOptions, TModel>(TModel, String, Func<TModel, TViewModel>, Func<TModel, TOptions>)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions, TModel>(this TModel model, string containerId, Func<TModel, TViewModel> viewModelSelector, Func<TModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
TModel | model | The database model to be converted in a view model and wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
Func<TModel, TViewModel> | viewModelSelector | A function that can be used to define how your view model should be created from your model. |
Func<TModel, TOptions> | optionsSelector | A function that can be used to define how your view model
should be wrapped in a |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
TModel | The type of your (database) model. |
ToDynamicList<TViewModel, TOptions, TModel>(TModel, String, Func<TModel, TOptions>)
Wraps a single view model into a partial dynamic list that can be sent back to the client.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions, TModel>(this TModel model, string containerId, Func<TModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
TModel | model | The database model to be converted in a view model and wrapped in a partial dynamic list. |
String | containerId | The div ID of the already existing dynamic list container. |
Func<TModel, TOptions> | optionsSelector | A function that can be used to define how your view model
should be wrapped in a |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> | A partial dynamic list with a single item that can be passed to the client. |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view model. |
TOptions | The type of the options to be associated with your view model. |
TModel | The type of your (database) model. |
ToDynamicList<TViewModel, TOptions, TModel>(IEnumerable<TModel>, Func<TModel, TViewModel>, Func<TModel, TOptions>)
Converts a list of TViewModel
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions, TModel>(this IEnumerable<TModel> models, Func<TModel, TViewModel> viewModelSelector, Func<TModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TModel> | models | A list of database models to be converted into view models, wrapped in
|
Func<TModel, TViewModel> | viewModelSelector | A function that can be used to define how your view model should be created from your model. |
Func<TModel, TOptions> | optionsSelector | A function that can be used to define how your view model
should be wrapped in a |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view models. |
TOptions | The type of the options to be associated with your view models. |
TModel | The type of your (database) models. |
ToDynamicList<TViewModel, TOptions, TModel>(IEnumerable<TModel>, Func<TModel, TOptions>)
Converts a list of TViewModel
objects into
a DynamicList<TViewModel, TOptions>.
Declaration
public static DynamicList<TViewModel, TOptions> ToDynamicList<TViewModel, TOptions, TModel>(this IEnumerable<TModel> models, Func<TModel, TOptions> optionsSelector)
where TViewModel : class where TOptions : DynamicListItem<TViewModel>, new()
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TModel> | models | A list of database models to be converted into view models, wrapped in
|
Func<TModel, TOptions> | optionsSelector | A function that can be used to define how your view model
should be wrapped in a |
Returns
Type | Description |
---|---|
DynamicList<TViewModel, TOptions> |
Type Parameters
Name | Description |
---|---|
TViewModel | The type of your view models. |
TOptions | The type of the options to be associated with your view models. |
TModel | The type of your (database) models. |