Could I do this as a background job on Startup? Would it then be able to use EF?
No, I tried that first and could not get it to work. Same problem as with the attribute (which I tried next).
We are using ASP.NET Zero 10.2. ASP.NET Core 5 and Angular 11.
I would like to be able run a Domain Service method only when the app is started.This method needs a unit of work so that I can work with my repositories. Is this possible?
I was trying to call it from <projectname>CoreModules.cs
ie like this
public override void PostInitialize() { IocManager.RegisterIfNot<IChatCommunicator, NullChatCommunicator>(); IocManager.Resolve<ChatUserStateWatcher>().Initialize(); IocManager.Resolve<AppTimes>().StartupTime = Clock.Now; IocManager.Resolve<IMyDomainService>().Run(); }
But the UnitOfWork attribute I used for the Run() method would not work. ie
[UnitOfWork] public void Run() { DoSomething(); }
I kept getting the following exception:
Abp.AbpException: Unknown filter name: MayHaveTenant. Be sure this filter is registered before. at Abp.Domain.Uow.UnitOfWorkBase.GetFilterIndex(String filterName) at Abp.Domain.Uow.UnitOfWorkBase.SetFilterParameter(String filterName, String parameterName, Object value) at Abp.Domain.Uow.UnitOfWorkBase.SetTenantId(Nullable1 tenantId, Boolean switchMustHaveTenantEnableDisable) at Abp.Domain.Uow.UnitOfWorkBase.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkManager.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.BackgroundJobStoreProxy.GetWaitingJobs(Int32 maxResultCount) at Abp.BackgroundJobs.BackgroundJobManager.DoWork() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Threading.BackgroundWorkers.PeriodicBackgroundWorkerBase.Timer_Elapsed(Object sender, EventArgs e)
Many thanks for you help.
I also have this problem. Is there ever going to be an answer on this?
error NG8004: No pipe found with name 'localize'.
@ismcagdas ???
I dont think you can do this with git merge. The problem is that the code (existing code and latest ASP.NET Zero version) is in two separate repos (locations). So better to use a tool like Beyond Compare for the merge.
PS following the steps fro "New Projects" after the steps for "Existing Projects" makes no sense at all. The aspnetzero branch already has the version of ASP.NET Zero we are trying to upgrade to in it. We branched from master to dev and then to aspnetzero. So in "Existing Projects" instructions we put the latest version of ASP.NET Zero there. Hence that is what is in the aspnetzero branch.
Hence following the "New Project" instructions now means we are just doing "git merge aspnetzero" on the dev branch. That does nothing.
Hi this is still not clear to me. Like with amrsaafan I have just found that your instuctions on here do not work: https://docs.aspnetzero.com/en/common/latest/Version-Updating#new-projects.
We have an existing project so we should follow the "Existing Projects" instructions.
But it says the following:
OOOOPS, step 3 is just going to clobber the code in the migrate branch - completely ovwerwrite it and so no merge will happen. The damage is done.
Then ismcagdas says "Sorry about the confusion. Yes, this is correct. After this step, you need to follow the New Project Instuctions". Ummm no - that does not make sense at all.
Can we start with the "Existing Project" instructions. From the step "Copy your existing code into migrate branch" - nothing is right with the instructions ... can we get the correct set of instructions please?
Duhh - ahh yes, of course. Many thanks!
Hi,
I want to set up data APIs to be consumes by my Reporting WebApp like this: https://demodata.grapecity.com/swagger/index.html?urls.primaryName=Restful%20NorthWind
This may be a dumb question, BUT, in ASP.NET Zero it appears that I have to do the following to generate my GETs:
public ListResultDto<OrderDataDto> GetOrders()
public OrderDataDto GetOrder(EntityDto input)
What I really want to do is:
public ListResultDto<OrderDataDto> Orders()
public OrderDataDto Orders(EntityDto input)
ie
GET /api/services/app/Data/Orders
GET /api/services/app/Data/Orders/{id}
But this ends up with an error in Swagger. How can I use REST HTTP verbs properly with Data Object names such as with: https://demodata.grapecity.com/swagger/index.html?urls.primaryName=Restful%20NorthWind???
Many thanks
Ahh - you are right! Many thanks. I have fixed it now,
I see in asp.net zero you have this:
public IActionResult Index()
{
if (_webHostEnvironment.IsDevelopment())
{
return RedirectToAction("Index", "Ui");
}
return Redirect("/index.html");
}
Considering there is no index.html - why do you have this for production?
In my webapp that works it is just:
public IActionResult Index()
{
return RedirectToAction("Index", "Ui");
}