-
-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry pick: Ensures that before adding an item to a collection with …
…identity management the next identity value will be unique within the collection. Fixes #3581
- Loading branch information
1 parent
2f54bd5
commit c8f5e1b
Showing
11 changed files
with
223 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="GraphMergeTests.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: https://cslanet.com | ||
// </copyright> | ||
// <summary>no summary</summary> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace Csla.Test.GraphMerge | ||
{ | ||
internal class BranchUniqueIdentities : BusinessBase<BranchUniqueIdentities> | ||
{ | ||
public static readonly PropertyInfo<Guid> IdProperty = RegisterProperty<Guid>(nameof(Id)); | ||
public Guid Id | ||
{ | ||
get => GetProperty(IdProperty); | ||
private set => SetProperty(IdProperty, value); | ||
} | ||
|
||
public static readonly PropertyInfo<LeafsUniqueIdentities> LeafsProperty = RegisterProperty<LeafsUniqueIdentities>(nameof(Leafs)); | ||
public LeafsUniqueIdentities Leafs | ||
{ | ||
get => GetProperty(LeafsProperty); | ||
private set => SetProperty(LeafsProperty, value); | ||
} | ||
|
||
[FetchChild] | ||
private async void Create([Inject] IChildDataPortal<LeafsUniqueIdentities> leafsPortal) | ||
{ | ||
using (BypassPropertyChecks) | ||
{ | ||
Id = Guid.NewGuid(); | ||
|
||
Leafs = await leafsPortal.FetchChildAsync(); | ||
} | ||
} | ||
|
||
[InsertChild] | ||
private async Task Insert() | ||
{ | ||
await FieldManager.UpdateChildrenAsync(); | ||
} | ||
|
||
[UpdateChild] | ||
private void Update() | ||
{ | ||
FieldManager.UpdateChildren(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="GraphMergeTests.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: https://cslanet.com | ||
// </copyright> | ||
// <summary>no summary</summary> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace Csla.Test.GraphMerge | ||
{ | ||
internal class LeafUniqueIdentities : BusinessBase<LeafUniqueIdentities> | ||
{ | ||
public static readonly PropertyInfo<int> LeafIdProperty = RegisterProperty<int>(nameof(LeafId)); | ||
public int LeafId | ||
{ | ||
get => GetProperty(LeafIdProperty); | ||
set => SetProperty(LeafIdProperty, value); | ||
} | ||
|
||
[Create] | ||
[CreateChild] | ||
private async Task Create(int leafId) | ||
{ | ||
using (BypassPropertyChecks) | ||
{ | ||
LeafId = leafId; | ||
} | ||
|
||
await BusinessRules.CheckRulesAsync(); | ||
} | ||
|
||
[InsertChild] | ||
private void Insert() { } | ||
|
||
[FetchChild] | ||
private void Fetch(int id) | ||
{ | ||
using (BypassPropertyChecks) | ||
{ | ||
LeafId = id; | ||
} | ||
} | ||
} | ||
} |
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,25 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="GraphMergeTests.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: https://cslanet.com | ||
// </copyright> | ||
// <summary>no summary</summary> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace Csla.Test.GraphMerge | ||
{ | ||
internal class LeafsUniqueIdentities : BusinessListBase<LeafsUniqueIdentities, LeafUniqueIdentities> | ||
{ | ||
[FetchChild] | ||
private async void Fetch([Inject] IChildDataPortal<LeafUniqueIdentities> childDataPortal) | ||
{ | ||
using (LoadListMode) | ||
{ | ||
foreach (var id in Enumerable.Range(1, 5)) | ||
{ | ||
Add(await childDataPortal.FetchChildAsync(id)); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,50 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="GraphMergeTests.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: https://cslanet.com | ||
// </copyright> | ||
// <summary>no summary</summary> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace Csla.Test.GraphMerge | ||
{ | ||
internal class RootUniqueIdentities : BusinessBase<RootUniqueIdentities> | ||
{ | ||
public static readonly PropertyInfo<Guid> IdProperty = RegisterProperty<Guid>(nameof(Id)); | ||
public Guid Id | ||
{ | ||
get => GetProperty(IdProperty); | ||
private set => SetProperty(IdProperty, value); | ||
} | ||
|
||
public static readonly PropertyInfo<BranchUniqueIdentities> BranchProperty = RegisterProperty<BranchUniqueIdentities>(nameof(Branch)); | ||
public BranchUniqueIdentities Branch | ||
{ | ||
get => GetProperty(BranchProperty); | ||
private set => SetProperty(BranchProperty, value); | ||
} | ||
|
||
[Fetch] | ||
private async void Create([Inject] IChildDataPortal<BranchUniqueIdentities> portalBranch) | ||
{ | ||
using (BypassPropertyChecks) | ||
{ | ||
Id = Guid.NewGuid(); | ||
|
||
Branch = await portalBranch.FetchChildAsync(); | ||
} | ||
} | ||
|
||
[Insert] | ||
private async Task Insert() | ||
{ | ||
await FieldManager.UpdateChildrenAsync(); | ||
} | ||
|
||
[Update] | ||
private async Task Update() | ||
{ | ||
await FieldManager.UpdateChildrenAsync(); | ||
} | ||
} | ||
} |
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
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