1

In MembershipReboot Documentation described ability use few tenants in app.

<membershipReboot multiTenant="true" defaultTenant="SomeName" />

But there are no examples how to implement crud for tenants using ravendb. Please share link or provide example if you have.

Thank you.

MaxD
  • 254
  • 1
  • 3
  • 14

1 Answers1

1

If you mean is there a way to CRUD Tenant objects, there isn't any because there isn't any such thing as a tenant object. It's simply a string that operates as a discriminator in the database. You need to pass in your own tenant string.

If you mean creating a user there isn't much too it. You have to implement a RavenDB Repository. (see here Sample RavenDb implementation), then simply call the create method on the UserAccountService

        var securitySettings = new SecuritySettings
        {
            AllowLoginAfterAccountCreation = true,
            MultiTenant = true,
        };

        var config = new MembershipRebootConfiguration<HierarchicalUserAccount>(securitySettings);
        var repository = new RavenUserAccountRepository("");

        var uas = new UserAccountService<HierarchicalUserAccount>(config, repository);

        var userAccount = uas.CreateAccount("tenant_id", "username", "password", "test@test.com");
Steven
  • 860
  • 6
  • 24