i didn't saw that it was already on the documentation :mrgreen: Well, that's not my creation, it's from another developer :oops:
it appears that : (source [https://coderwall.com/p/gvrn4w/update-all-nuget-packages-in-a-solution-matched-by-name]))
ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }
is faster to execute than : (source [https://coderwall.com/p/wtobfg/update-all-nuget-packages-in-a-solution-matched-by-name--2]))
get-project -all | get-package | ?{ $_.Id -like 'Abp*' } | update-package
by avoiding unecessary check.
The complexity of the original one is too big as it tries to update all packages found for all projects, instead of just the packages present on each project.
the current one works fine, but i've already 28 projects in my solution, so it takes a lot of time ;)
to update all Abp* packages from nuget console :
ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }
To close this subjet; I abandonned the idea of datetimeoffset in my db.
I converted every datetime in my db in UTC format and used the clock.provider like you said ("timing" in your doc).
datetimeoffset could be good to be stored; but not in my case anymore.
subject closed months after :mrgreen:
Hello,
I have a console which runs multiple operations on multiple database.
rather than use SetTenantId in the Manager (too much change, don't match with my app logic), i would like to modify the IAbpSession on the fly to use the UnitOfWork with the correct database.
Right now (based on your sample), I ovveride the AbpSession in the PreInitialize of my module. Can i replace it anywhere in my code, and how ?
[DependsOn(typeof (SSSSDataModule), typeof (SSSSApplicationModule))]
public class SSSSSServerAppModule : AbpModule
{
public override void PreInitialize()
{
//Suppress authentication and permission checking for the application, register as tenant configured in app.config
IocManager.Register<IAbpSession, TenantAppSession>();
IocManager.Register<IPermissionChecker, NullPermissionChecker>();
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
thanks for your help !
FYI, i created a console project to create multiple tenant at once.
my code look like this :
const string tenantConnectionString = "Data Source=XXXXXXXX;Integrated Security=False;User ID=XXXXXXXXX;Password=XXXXXXXX;Initial Catalog=XXXXXXXXX;";
var tenantId = _tenantManager.CreateWithAdminUserAsync("XXXXX", "XXXXXXX", "XXXXXXX", "xxxxxxxxxxx", xXXXXXX, true, null, false, false).Result;
SeedXXXX(tenantId);
protected void SeedXXXX(int tenantId)
{
using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
{
using (_unitOfWorkManager.Current.SetTenantId(tenantId))
{
var context = _unitOfWorkManager.Current.GetDbContext<XXXXXDbContext>();
new XXXXXXDbBuilder(context).Create();
_unitOfWorkManager.Current.SaveChanges();
}
uow.Complete();
}
}
yup, maybe I need to clean a little bit my code, i'm not yet a pro of unitofwork ;)
+1, i'm in the same case for a lot of table and I was going to ask the same question :D
For some tables, I use an unique PK which is not guid (for example a datetime or int; for optimisation/size purpose). Most of my case are separate databases with column TenantId set. But if I need to merge them into one db; TenantId will be correct but PK will be duplicated. (logic)
If I create a composite key (that's the only way I see ...), i'll rewrite a lot of code since almost all of my tables have IMustHaveTenant. And create a lot of DTO to remove the tenantId property.
But that's the only way that I see; so i'm going to go on this way.
Waiting for your reply/suggestions if you have another idea ;)
Hello there !
i'm moving my architecture to an database per tenant approach. My app will have connected users and public (anonymous) users.
my main app could be accessed by logged user (full function) or anonymous user (restricted function) but both of them use data specific from each tenant.
So, I need that an anonymous user which retrieve the index.cshtml from HomeController have the tenantId to retrieve WebAPI requests from the correct database.
Based on the {TENANCY_NAME}.mydomain.com (or other full url); i could know which tenant is requested in my homeController. Is it possible to have the tenantId set somewhere for the anonymous user ?
I could include the tenant Id manually in each request to WebAPI, but it seems not efficient at all since it's already implemented in ABP based on the user session.
my HomeController is like this right now :
[AbpMvcAuthorize]
public ActionResult Index()
{
return View(AbpSession.TenantId != null ? "~/App/Main/views/index.cshtml" : "~/App/Dashboard/common/views/layout/layout.cshtml");
I would like to go somewhere like this :
[AllowAnonymous]
public ActionResult Index()
{
if (AbpSession == null)
{
//set the session to anonymous user with specific tenant Id based on subdomain
}
return View(AbpSession.TenantId != null ? "~/App/Main/views/index.cshtml" : "~/App/Dashboard/common/views/layout/layout.cshtml");
Thanks for your help !
already discussed here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/883">https://github.com/aspnetboilerplate/as ... issues/883</a>
right now, it still works even if it's marked obsolete :)
I'm in the same case.
When a new release is out (for nuget + aspnetzero Template) :
and voila ... in conclusion, there is no magic solution.
note : wait for the 0.9.2 version, there is some bug on 0.9.1.1 :)
making a new branch for every new version will be a nightmare in TFS, but it's up to you :) Good branch : (following the correct order of publishing dev->test->acc->prod)
Hi guys,
I struggle a little bit to understand methodoly of creating a new tenant in "Single Deployment - Multiple Database".
I would like to create default DB for host (managing editions/tenants), and a sub DB foreach tenant (different connection string).
regarding this code
if (Tenant == null)
{
//Host seed
new InitialHostDbBuilder(context).Create();
//Default tenant seed (in host database).
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
new InitialCustomDbBuilder(context).Create();
}
else
{
//new TenantRoleAndUserBuilder(context, Tenant.Id).Create();
//new InitialCustomDbBuilder(context).Create();
}
is the default tenant mandatory ? (even if we don't use it)
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
if the seed run into the else{} method (tenant creation, when we specify a connectionstring in dashboard), do we need to change the connectionstring with this method to set seed into the correct db ?
(_unitOfWorkManager.Current.SetTenantId(tenantId))
Thanks for your help! ;)