Skip to content

Structure for sharing data between users. #247

Closed Answered by mruncola
mruncola asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you Adrian, the view was a nice way to accomplish.

For anyone wanting to do something like this in the future.

Added view "DevicesMerged" to db:

SELECT d.*, s.SharedToUserId FROM Device d LEFT JOIN DeviceShare s ON d.Id = s.DeviceId

Set up Entity:

public class DeviceMerged : Device, ISharedToUserId
{
    public string? SharedToUserId { get; set; }
}

Setting up the entity to work via the view:

modelBuilder.Entity\<DeviceMerged\>(entity =>
{
    entity.ToView("DevicesMerged");
});

Created a IAccessControlProvider following this sample:
https://communitytoolkit.github.io/Datasync/in-depth/server/index.html#configure-access-permissions

Modified the class to SharedViewPrivateAccessContro…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mruncola
Comment options

Answer selected by adrianhall
@adrianhall
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants