Skip to content

Commit 7792353

Browse files
committed
add documentation
1 parent 8e79c5c commit 7792353

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: src/JsonApiDotNetCore/Builders/ContextGraphBuilder.cs

+4
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public IContextGraphBuilder AddDbContext<T>() where T : DbContext
195195

196196
private string GetResourceNameFromDbSetProperty(PropertyInfo property, Type resourceType)
197197
{
198+
// this check is actually duplicated in the DefaultResourceNameFormatter
199+
// however, we perform it here so that we allow class attributes to be prioritized over
200+
// the DbSet attribute. Eventually, the DbSet attribute should be deprecated.
201+
//
198202
// check the class definition first
199203
// [Resource("models"] public class Model : Identifiable { /* ... */ }
200204
if (resourceType.GetCustomAttribute(typeof(ResourceAttribute)) is ResourceAttribute classResourceAttribute)

Diff for: src/JsonApiDotNetCore/Graph/IResourceNameFormatter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public string FormatResourceName(Type type)
3535
{
3636
try
3737
{
38+
// check the class definition first
39+
// [Resource("models"] public class Model : Identifiable { /* ... */ }
3840
if (type.GetCustomAttribute(typeof(ResourceAttribute)) is ResourceAttribute attribute)
3941
return attribute.ResourceName;
4042

0 commit comments

Comments
 (0)