-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support discovering foreign keys via [ForeignKeyAttribute] plac…
…ed on a collection navigation props. Support foreign keys that do not have a reference navigation prop.
- Loading branch information
Showing
13 changed files
with
177 additions
and
25 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
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
12 changes: 12 additions & 0 deletions
12
src/IntelliTect.Coalesce.Tests/TargetClasses/TestDbContext/ComplexModelDependent.cs
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,12 @@ | ||
namespace IntelliTect.Coalesce.Tests.TargetClasses.TestDbContext | ||
{ | ||
public class ComplexModelDependent | ||
{ | ||
public int Id { get; set; } | ||
|
||
// Foreign key without nav prop (discovered by ForeignKeyAttribute on the inverse collection navigation). | ||
public int ParentId { get; set; } | ||
|
||
public string Name { get; set; } | ||
} | ||
} |
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
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
40 changes: 40 additions & 0 deletions
40
src/IntelliTect.Coalesce.Tests/Util/PropertyViewModelData.cs
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,40 @@ | ||
using IntelliTect.Coalesce.TypeDefinition; | ||
using System; | ||
using Xunit.Abstractions; | ||
|
||
namespace IntelliTect.Coalesce.Tests.Util | ||
{ | ||
public class PropertyViewModelData : ClassViewModelData | ||
{ | ||
public string PropName { get; private set; } | ||
|
||
public PropertyViewModel PropertyViewModel => ClassViewModel.PropertyByName(PropName); | ||
|
||
public PropertyViewModelData() | ||
{ | ||
} | ||
|
||
public PropertyViewModelData(Type targetType, string propName, Type viewModelType) : base(targetType, viewModelType) | ||
{ | ||
PropName = propName; | ||
} | ||
|
||
public override void Deserialize(IXunitSerializationInfo info) | ||
{ | ||
base.Deserialize(info); | ||
PropName = info.GetValue<string>(nameof(PropName)); | ||
} | ||
|
||
public override void Serialize(IXunitSerializationInfo info) | ||
{ | ||
base.Serialize(info); | ||
info.AddValue(nameof(PropName), PropName); | ||
} | ||
|
||
public static implicit operator PropertyViewModel(PropertyViewModelData self) | ||
=> self.PropertyViewModel; | ||
|
||
public override string ToString() => | ||
$"({(ViewModelType.Name.StartsWith("Sym") ? "Symbol" : "Reflect")}) {new ReflectionTypeViewModel(TargetType).FullyQualifiedName}.{PropName}"; | ||
} | ||
} |
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
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