Skip to content

Commit bdf9c0a

Browse files
docs(grid): filtering no longer uses activator.createinstance()
1 parent 2c6a007 commit bdf9c0a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

components/grid/columns/bound.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ You can use the following properties on the bound columns:
9696
* If a `Field` is not set the column will not allow filtering, grouping, sorting and editing for the column.
9797
* If the `Field` points to a custom object or something like an `IDictionary`, errors will be thrown upon those actions because there are no known data operations on non-primitive types in .NET. An alternative is to implement all data source operations yourself by handling the [OnRead event](../manual-operations).
9898
* To bind to nested (complex) models (also called navigation properties), use only the name of the field that holds the child class and its own field. For an example, see the [Bind to navigation properties in complex objects]({%slug grid-use-navigation-properties%}) article.
99+
99100
* The grid skips fields marked with the [`IgnoreDataMemberAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.ignoredatamemberattribute) when performing CUD operations. Its presence indicates that this property does not need to be part of the serialized data anyway, and skipping such fields allows [Lazy Loading Proxies in EF](https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.proxiesextensions.uselazyloadingproxies?view=efcore-3.1) to work.
101+
100102
* If you don't set a `Title` for a column, the grid will take the `[Display(Name = "My Column Title")]` data annotation attribute from the model field. If that's not available either, the name of the field will be shown.
103+
101104
* If you want to prevent data mutation for a specific property you can set the `Editable` parameter of the GridColumn or the `[Editable]` data annotation attribute to `false` for the desired model field.
102-
* Columns generated out of model properties that do not have a `setter` or it is not accessible (private) will not be editable too.
103-
* The Grid uses `Activator.CreateInstance<TItem>();` to generate a new item when an Insert or Filter action is invoked, so the Model should have a Parameterless constructor defined. A workaround for Insert operations might be [invoking them through the grid state]({%slug grid-state%}#initiate-editing-or-inserting-of-an-item) and creating the object with your own code.
105+
* Columns generated out of model properties that do not have a `setter` or it is not accessible (private) will not be editable too.
106+
107+
* The Grid uses `Activator.CreateInstance<TItem>();` to generate a new item when an Insert action is invoked, so the Model should have a Parameterless constructor defined. A workaround might be [invoking Insert through the grid state]({%slug grid-state%}#initiate-editing-or-inserting-of-an-item) and creating the object with your own code.
104108

105109

106110
>tip You can optimize database queries in two ways:

components/grid/editing/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ There are a few considerations to keep in mind with the CUD operations of the gr
191191

192192
* The CRUD event handlers must be `async Task` and **not** `async void`. A Task can be properly awaited and allows working with services and contexts. When the method returns `void`, the execution of the context operations is not actually awaited, and you may get errors from the context (such as "Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application" or "A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext").
193193

194-
* The Grid uses `Activator.CreateInstance<TItem>();` to generate a new item when an Insert or Filter action is invoked, so the Model should have a Parameterless constructor defined. A workaround for Insert operations might be [invoking them through the grid state]({%slug grid-state%}#initiate-editing-or-inserting-of-an-item) and creating the object with your own code.
194+
* The Grid uses `Activator.CreateInstance<TItem>();` to generate a new item when an Insert action is invoked, so the Model should have a Parameterless constructor defined. A workaround might be [invoking Insert through the grid state]({%slug grid-state%}#initiate-editing-or-inserting-of-an-item) and creating the object with your own code.
195195

196196
## See Also
197197

0 commit comments

Comments
 (0)