diff --git a/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md b/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md index 0617e1667e..085b474389 100644 --- a/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md +++ b/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md @@ -215,6 +215,26 @@ The following sample code demonstrates how to inject a service into the Custom A @code{ + + protected override void OnInitialized() + { + Orders = Enumerable.Range(1, 75).Select(x => new Order() + { + OrderID = 1000 + x, + CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], + Freight = 2.1 * x, + OrderDate = DateTime.Now.AddDays(-x), + }).ToList(); + } + + public class Order + { + public int? OrderID { get; set; } + public string CustomerID { get; set; } + public DateTime? OrderDate { get; set; } + public double? Freight { get; set; } + } + // Custom adaptor class that extends the DataAdaptor class. public class CustomAdaptor : DataAdaptor { @@ -985,6 +1005,26 @@ The following sample code demonstrates how to implement CRUD operations for cust @code{ + + protected override void OnInitialized() + { + Orders = Enumerable.Range(1, 75).Select(x => new Order() + { + OrderID = 1000 + x, + CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], + Freight = 2.1 * x, + OrderDate = DateTime.Now.AddDays(-x), + }).ToList(); + } + + public class Order + { + public int? OrderID { get; set; } + public string CustomerID { get; set; } + public DateTime? OrderDate { get; set; } + public double? Freight { get; set; } + } + // Custom adaptor implementation by extending the DataAdaptor class. public class CustomAdaptor : DataAdaptor {