Base solution for your next web application

Activities of "statuscast"

Answer

Not sure why it seems "uncommon", Partial classes are incredibly powerful. There's ZERO effect and no downside to marking the AspNetZero classes as partial for us. It would let our code sit side-by-side much easier. As it stands right now, everytime we want to enhance or extend your code, we are boxing ourselves in from any upgrades you release unless we want to spend days and days merging source code.

Why couldn't AspNetZero just go through and mark all their classes as partial for us? It would allow everyone to put most of their custom code that needs to be integrated directly into AspNetZero code in seperate files.

Question

Is there any significant reason why we can't change pretty much every class in all AspNetZero projects to PARTIAL classes? This would make preserving source files integrity during AspNetZero's frequent upgrade process much easier. That was we could extend services, entities, etc without having to modify your original source files or relying on inheritence. Simple and clean.

Hi all --

This issue has been ongoing with every release of AspNetZero since becoming a customer. The first thing i do when we grab a new version is to go update all Nuget Packages.

Everytime, without fail, we get this Hangfire issue. I'm not 100% sure why this is happening or not being fixed, but not being able to update Hangfire packages is a problem -- they are rapidly fixing and releasing major issues. I think somewhere in the project there's a hard coded version. Can we please get this fixed?

To reproduce, just install latest version in a new directory, load solution, and Update all nuget packages at the solution level.

Thanks!

Severity Code Description Project Path File Line Suppression State Error NU1107 Version conflict detected for Hangfire.Core. Install/reference Hangfire.Core 1.6.23 directly to project StatusCast.Web.Core to resolve this issue. StatusCast.Web.Core -> Hangfire.SqlServer 1.6.23 -> Hangfire.Core (= 1.6.23) StatusCast.Web.Core -> Abp.HangFire.AspNetCore 4.4.0 -> Hangfire.AspNetCore 1.6.22 -> Hangfire.Core (= 1.6.22). StatusCast.Web.Core C:\Users\jasen\Desktop\aspnetzero.latest\aspnet-core\src\StatusCast.Web.Core C:\Users\jasen\Desktop\aspnetzero.latest\aspnet-core\src\StatusCast.Web.Core\StatusCast.Web.Core.csproj 1 Error Package restore failed. Rolling back package changes for 'StatusCast.Web.Core'.

Nope, we gave up. Couldn't get it to work.

I understand. and I am pretty familiar with the places your team uses session info within domain services. It just is usually considered not-advisable as it ties the domain service to the application layer. In fact, your own documentation re-iterates that:

"Since authentication/authorization is an application layer task, it's advisable to use the IAbpSession in the application layer and upper layers. This is not generally done in the domain layer. ApplicationService, AbpController, AbpApiController and some other base classes have AbpSession already injected, so you can, for instance, directly use the AbpSession property in an application service method"

This was just a philosophical discussion. I was looking for some additional guidelines or suggestions. For now, we are not allowing the use of any AbpSession object within our domain services. Everything has to be passed in. That way they never assume there "is" a session and no kludgy if AbpSession is null stuff.

Hi,

I know the recommendation is to not use AbpSession information back within our Domain Services. I actually like that concept and can wrap my head around it. However, I'm curious what the recommendation is for implementing certain logic.

If I have an entity, say "OrganizationUnit" and I implement a DomainService to

a) retrieve a list of OrganiztionUnits b) filtered by only those entites that the current user is associated with c) store and manage the resulting filtered list within a redis cache (along with some other DomainService CRUD transactions)

something like "GetOrganizationUnitsForUser"

It's pretty obvious this type of work should not go into the ApplicationService as there is some low level caching going on and its a generic call that may be used by different applications. So, the method needs UserId. Is the recommendation to still stay away from using AbpSession in the domainService and simply pass filters (like UserId in this example)?

This is a VERY common problem in that we have lots of complicated queries that we want to filter based on roles, inclusion in organizationUnits, etc. They all require knowing something about who is querying them... but if we purposefully restrict access to AbpSession within our domain services, then we end up simply needing to pass properties in to the method, which is kind of the same thing.

I definitely don't want the domain services to always just be returning big unfiltered lists and rely on the ApplicationServices to always have to filter. That will result in a lot of redundant repository queries and allow for mistakes and forgettfulness in the AppService layer.

Curious as to the Abp/Az team's thoughts on this...

Sorry for late response. We are just going to try and use the native Abp Redis caching. Trying to use DI for some third party modules has turned out to be a nightmare.

I'm sorry but I have no clue how that article helps me get access to the IApplicationBuilder app in to an Xunit application that has no Configure() method in the first place.

I apologize for missing something....?

Hi,

I have been partially successful at getting Hangfire working within the XUnit tests. However, I am having one last (I hope) issue. I simply added the following to MyProjectTestModule.cs Preinitialize:

Configuration.BackgroundJobs.UseHangfire(); GlobalConfiguration.Configuration.UseSqlServerStorage(configuration["ConnectionStrings:Hangfire"]);

However, since the structure of the Xunit app does not provide a Configure startup mechanism, where do we put startup code:

                var options = new BackgroundJobServerOptions
                {
                    WorkerCount = Environment.ProcessorCount * threads,
                    Queues = queues,
                    ServerTimeout = new TimeSpan(0, 2, 0)
                };
                app.UseHangfireServer(options);
            
            

Thank you.

Greetings.

Has anyone had any success integrating EFSecondLevelCache.Core and their Redis setup? It's a recommended tool by Microsoft if you want to introduce caching on EntityFrameworkCore.

Abp/Az offers entity level caching out of the box, but it doesn't provide query result caching inherently, so it's either go write a lot of code or try to integrate something like EFSecondLevelCache.Core into Abp so that I can cache a query result easily like this:

var result = _repository.GetAll().Where(x=>x.Something>5).Cacheable().ToList();

That Cacheable extension is incredibly nice and simplifies me having to manually add items to Redis, manage unique key names for each query, etc.

I added their code to Startup as per their instructions:

`services.AddEFSecondLevelCache();

            // Add Redis cache service provider
            var jss = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };

            const string redisConfigurationKey = "redis";
            string connectionString = _appConfiguration["Abp:RedisCache:ConnectionString"];
            services.AddSingleton(typeof(ICacheManagerConfiguration),
                new CacheManager.Core.ConfigurationBuilder()
                    .WithJsonSerializer(serializationSettings: jss, deserializationSettings: jss)
                    .WithUpdateMode(CacheUpdateMode.Up)
                    .WithRedisConfiguration(redisConfigurationKey, config =>
                    {                            
                        config.WithAllowAdmin()
                            .WithDatabase(0) // (int.Parse(_appConfiguration["Abp:RedisCache:DatabaseId"]))
                            .WithEndpoint(connectionString, 6379);                            
                    })
                    .WithMaxRetries(100)
                    .WithRetryTimeout(50)
                    .WithRedisCacheHandle(redisConfigurationKey)
                    .WithExpiration(ExpirationMode.Absolute, TimeSpan.FromMinutes(10))
                    .Build());
            services.AddSingleton(typeof(ICacheManager<>), typeof(BaseCacheManager<>));`
            

and

app.UseEFSecondLevelCache();

but as soon as try using the .Cacheable() like the above line is called I get CastleWindsor errors:

Exception thrown: 'Castle.MicroKernel.ComponentActivator.ComponentActivatorException' in System.Private.CoreLib.dll Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter: 2018-11-20 14:49:30,995 [12] ERROR Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter ComponentActivator: could not instantiate CacheManager.Core.BaseCacheManager1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate CacheManager.Core.BaseCacheManager1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] ---> System.Exception: Could not instantiate CacheManager.Core.BaseCacheManager1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Connection to 'statuscast-test.redis.cache.windows.net:6380,allowAdmin=True,connectTimeout=5000,password=****,ssl=False,abortConnect=False,connectRetry=10,proxy=None' failed. at CacheManager.Core.BaseCacheManager1..ctor(String name, ICacheManagerConfiguration configuration) at CacheManager.Core.BaseCacheManager1..ctor(ICacheManagerConfiguration configuration) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) --- End of inner exception stack trace --- at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) --- End of inner exception stack trace --- at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.DefaultGenericHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) in D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\ScopedWindsorServiceProvider.cs:line 55 at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at EFSecondLevelCache.Core.EFCachedQueryExtensions.configureProviders() at EFSecondLevelCache.Core.EFCachedQueryExtensions.Cacheable[TType](IQueryable1 query, String saltKey, EFCacheDebugInfo debugInfo) at StatusCast.EntityFrameworkCore.Repositories.IncidentRepository.GetFullAsync(Int64 id) in C:\src\statuscast\server.v3\src\StatusCast.EntityFrameworkCore\Incidents\IncidentsRepository.cs:line 30 at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task1 actualReturnValue, Func1 postAction, Action1 finalAction) at StatusCast.Incidents.IncidentAppService.GetIncident(Int64 incidentId) in C:\src\statuscast\server.v3\src\StatusCast.Application\Incidents\IncidentAppService.cs:line 126 at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task1 actualReturnValue, Func1 postAction, Action1 finalAction) at Abp.Threading.InternalAsyncHelper.AwaitTaskWithFinallyAndGetResult[T](Task1 actualReturnValue, Action1 finalAction) at StatusCast.Web.Controllers.IncidentController.GetIncident(Int64 id) in C:\src\statuscast\server.v3\src\StatusCast.Web.Core\Controllers\IncidentController.cs:line 39 at lambda_method(Closure , Object ) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync() StatusCastExceptionHandler: Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter, 11/20/2018 7:49:31 PM, ComponentActivator: could not instantiate CacheManager.Core.BaseCacheManager`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor: 2018-11-20 14:49:31,048 [12] INFO Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.

Showing 11 to 20 of 52 entries