-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add doc for indexer property (#2860)
Resolves #2018
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace EFModeling.FluentAPI.IndexerProperty | ||
{ | ||
class MyContext : DbContext | ||
{ | ||
public DbSet<Blog> Blogs { get; set; } | ||
|
||
#region ShadowProperty | ||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<Blog>().IndexerProperty<DateTime>("LastUpdated"); | ||
} | ||
#endregion | ||
} | ||
|
||
public class Blog | ||
{ | ||
private readonly Dictionary<string, object> _data = new Dictionary<string, object>(); | ||
public int BlogId { get; set; } | ||
public object this[string key] | ||
{ | ||
get => _data[key]; | ||
set => _data[key] = value; | ||
|
||
} | ||
} | ||
} |