Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "andmattia"

Abp 4.8.1 / EF Core 2.2

We are moving from .Net to .Net Core so now we need to convert a part where we need to call a remote MySql Server. In the past version we add a same issue and we solve it via Database.SetInitializer(null); but in EF Core this strategy cann't be applied.

Releted to our old thred Multi Db Context MySQL / MSSQL

Anyone has found a way to do that?

  • 4.8.1
  • Angular
  • .net core 2.2 / .net 4.6.1

Hi

we have an issue on abp and LINQ to SQL. We have create a JSON_VALUE function and it works fine until we try to call it from IQuerable static extension. Our project is very complex but I have create a empty project and add 2 DLL to reproduce the error. The step are:

  1. create 1 DLL (abp module or not is the same)

  2. create and abstract class to extend a AppService

  3. cerate a IQuerable extension to add a where with JSON_VALUE dbFunction

  4. if I call in base abstract class where I call ToList / ToArray I catch a NotImplemented Exception

  5. if I add the where directly on AppService and call ToList/ToArray the SQL will be translatend in correct way

            var query = from auditLog in _repository.GetAll()
                join user in _repositoryUser.GetAll() on auditLog.EditionId equals user.Id into userJoin
                from joinedUser in userJoin.DefaultIfEmpty()
                //where DemoEfCoreSqlJsonExtension.JsonValue(auditLog.TenancyName,"$") != null
                select new FullTenant { TenancyName = auditLog.TenancyName, Tenant = auditLog, Edition = joinedUser };
                
                var hjkh =  query.ToList();
                
                
                public static class DemoEfCoreSqlJsonExtension
    {
        [DbFunction("JSON_VALUE", "")]
        public static string JsonValue(string column, [NotParameterized] string path)
        {
            throw new NotSupportedException();
        }

        [DbFunction("JSON_QUERY", "")]
        public static string JsonQuery(string column, [NotParameterized] string path)
        {
            throw new NotSupportedException();
        }
    }
    
    public static class DemoQueryableExtensions
    {
        public static IQueryable<TGetAllListResult> DemoApplyExtraFieldFilter<TGetAllListResult>(
            this IQueryable<TGetAllListResult> query)
            where TGetAllListResult : class, IDynamicTelerikExtraFields
        {
            return Queryable.Where(query, x => DemoEfCoreSqlJsonExtension.JsonValue(x.TenancyName, "$") != null && Convert.ToDecimal(DemoEfCoreSqlJsonExtension.JsonValue(x.TenancyName, "$")) == 7);
        }
    }
    
    
    protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.HasDbFunction(() => DemoEfCoreSqlJsonExtension.JsonValue(default(string), default(string)));
            modelBuilder.HasDbFunction(() => DemoEfCoreSqlJsonExtension.JsonQuery(default(string), default(string)));

It wokrs only on AppService or Core Module but not from static Extension

Prerequisites

  • 7.1.0

  • Angular

  • .NetCore 2.2

  • all theme

I try to execute test via ng test or yarn test or yarn e2e but no one works I get this error on chrome

and on VSCode

How can I check what is wrong?

Regards

Prerequisites

  • 4.8.1
  • Angular
  • netCore 2.2

I try to test our method that derived from ApplicationService and I try to validate my permission via IPermissionChecker.Authorize.

When I test it I receive

Abp.AbpException
No language defined!
   in Abp.Localization.MultiTenantLocalizationDictionaryProvider.GetDefaultDictionary()
   in Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetStringOrNull(String name, CultureInfo culture, Boolean tryDefaults)
   in Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetString(String name, CultureInfo culture)
   in Abp.Localization.LocalizableString.Localize(ILocalizationContext context)
   in System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   in System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   in System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   in Abp.Authorization.PermissionCheckerExtensions.LocalizePermissionNames(IPermissionChecker permissionChecker, String[] permissionNames)
   in Abp.Authorization.PermissionCheckerExtensions.<AuthorizeAsync>d__9.MoveNext()

I look into base test project but I don't find anithing related to Localization/Language, how can I solve it?

Prerequisites

Please answer the following questions before submitting an issue.

  • 7.1.0
  • Angular
  • .net core 2.2 / .net 4.6.1

If issue related with ABP Framework

  • 4.8.1

I try to send a cancellation request from Angular client (use Observable -> unsubscribe) to cancel long Task Operation but API not fire.


    [HttpPost]
        public async Task<GetDataOutputDto> GetDataLongOperation(CustomInputDto input)
        {
            try
            {
                var tokenSource = new CancellationTokenSource(); // _httpContextAccessor.HttpContext.RequestAborted;
                tokenSource.CancelAfter(2500);

                var token = _httpContextAccessor.HttpContext.RequestAborted; //tokenSource.Token;

                var settings = new JsonSerializerSettings
                {
                    Error = (sender, args) => {
                        args.ErrorContext.Handled = true;
                    },
                    MissingMemberHandling = MissingMemberHandling.Ignore
                };


                //... remove for brev
        }

on angular side

                this.subscription = this.loadData(undefined).subscribe(res=>{
                    console.log('data loaded!');
                    this.localData = res.data;
                    //this._rawData = this.localData;
                    this.loadItems();
                    
                });

                setTimeout(() => {
                    console.log('TEST stop long') 
                    this.subscription.unsubscribe();
                }, 2500); 

I test that if I use TaskSource with CancelAfter all code behind work well but from web (client side) I can't fire the cancellation operation

We move our solution to .NET Core and Angular (AbpZero 7.1.0).

When I compile in production the build process create a main.js more the 5 Mb.

Is it possibile to reduce it? How can I check if I've some configuration error?

Regards

I

I add a custom interface to a DTO on a object defined on Application.Shared. If i use a IConventionalDependencyRegistrar to register it I don't find my object. My project is based on ABP 4.8.1 .NETCore (4.6.1)

For more complete understaning my landscape if I move my object to Application it is register it in correct way.

So my question is how to solve this issue because Application.Shared is used on Xmarin and is not a module, I need to convert it into a module? If yes is need to use a #IF #ENDIF statement on compilation to prevent module definition for Xamarin?

Question

I'm working on a solution wiht more EF and I'm able to call separete EF and use distributed query.

Last week I need to add a a connection to MongoDb to storage a Json data so I've created a custom repository connect my Entity to MongoDb and it work fine until I call that from an abstract base class.

The CreateQuery flow on correct repository because use concrete implementation (es Mongo or EF dipends on specific query body)

But when I call the CountAsync() how can I identify if my provider is Mongo or EF...

At the moment i create a SafeCountAsync() and cast to specific provider but I'm not sure that is the correct way to solve it.

Below some code from my solution

    public abstract IQueryable<TQueryReturnType> CreateQuery(TQueryInput input);
    
    public asbtract class MyBase{
    /// remove for brevity
    
     public virtual async Task<PagedResultDto<TListResult>> GetItems(TQueryInput input)
        {
            var query = CreateQuery(input).
                .ApplyFilter(input);

#if DEBUG
            Debug.WriteLine($"Query for {typeof(TQueryReturnType)}");
            Debug.Write(query?.ToString());
#endif

            //var count = await query.CountAsync();
            var count = await query.SafeCountAsync();
            
            }
}

// from static extension to call correct count
public static Task<int> SafeCountAsync<TSource>(this IQueryable<TSource> source)
        {
            IsValid(source);

            if (typeof(IMongoTable).IsAssignableFrom(typeof(TSource)))
            {
                return ((IMongoQueryable<TSource>)source).CountAsync();
            }
            else
            {
                // Default EF SQL
                return source.CountAsync();
            }
            
        }
Question

Hi

I have a question about this use case.

In an appalication multiTenant I create a user on Tenant 1.

This user start to work with the paltform and decide to subscribe a payment tenant for him, so I preapre some custom function to create, update data on new tenant and now my user (create on Tenat1 and link to it) is the admin of tenant 2. But tenant 1?

I try to think a possibile solution case.

Linked user. But is it the only/correct way to implement it.. Also

  • Any possibile issue?
  • With Linked user can I read data in different tenant?
  • Need to implement disable filter by tenant where I need?

Regards

Mat

I try to use the abp from NPM and it works on compilation but with some issue.

I compare the 2 different versione and I see the biggest broken change

If I remove the window.app on file from NPM all function works fine but if I don't do it the popup from abp not work, translation not work,...

Showing 11 to 20 of 64 entries