Base solution for your next web application

Activities of "tjackadams"

Hi @hikalkan,

maybe i have misunderstood slightly.

What my end goal is to implement an overload of InsertOrUpdate which accepts an IEnumerable as a parameter, so it does a bulk insert or update. I want to implement this for any entities that use the IRepository interface.

Is this possible in the Framework, or would i have to implement a custom repository for each entity and duplicate the logic?

Here is a code example of the method i am trying to implement for all repositories

public async Task InsertOrUpdateAsync(List<TEntity> entities)
        {
            var entitiesToAdd = new List<TEntity>();

            
            Context.Configuration.AutoDetectChangesEnabled = false;
            foreach (var account in entities)
            {
                entitiesToAdd.Add(account);
                if (entitiesToAdd.Count % 500 != 0)
                {
                    continue;
                }

                Context.Set<TEntity>().AddOrUpdate(entitiesToAdd.ToArray());
                entitiesToAdd = new List<TEntity>();
                Context.ChangeTracker.DetectChanges();
                await Context.SaveChangesAsync();
                Context.DetachAll();
            }

            Context.Set<TEntity>().AddOrUpdate(entitiesToAdd.ToArray());
            Context.ChangeTracker.DetectChanges();
            await Context.SaveChangesAsync();
            Context.DetachAll();
        }

Many thanks

Hello,

i am trying to add a custom method into the repository base, but when i do it doesn't show as an available option in the IRepository interface. Here is the declaration

public abstract class PortalRepositoryBase<TEntity, TPrimaryKey> : EfRepositoryBase<PortalDbContext, TEntity, TPrimaryKey>
        where TEntity : class, IEntity<TPrimaryKey>
    {
        
        public ILogger Logger { get; set; }
        protected PortalRepositoryBase(IDbContextProvider<PortalDbContext> dbContextProvider)
            : base(dbContextProvider)
        {
            Logger = NullLogger.Instance;
        }

        //add common methods for all repositories
        public void Test()
        {
            
        }
    }

    public abstract class PortalRepositoryBase<TEntity> : PortalRepositoryBase<TEntity, int>
        where TEntity : class, IEntity<int>
    {
        protected PortalRepositoryBase(IDbContextProvider<PortalDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        //do not add any method here, add to the class above (since this inherits it)
    }
}

and this is the implementation

public class AccountManager : AutoTaskBase, IAccountManager
    {
        private readonly IRepository<Account, long> _acountRepository;

        public AccountManager(
            IRepository<Account, long> accountRepository)
        {
            _accountRepository = accountRepository;
        }

     public voidRefreshAccountsAsync()
    {
        _accountRepository.Test();
    }

Is this the correct usage or do you have to implement a custom repository? The Test method is unavailable here . Thanks

Hello,

i am currently just building a page to manage permissions.

I am using jstree to populate the tree and then submitting the selected (and half selected) checkboxes. The form is submitted to an app service method. The permissions are obtained via this method

var permissions = _permissionManager.GetAllPermissions().Where(p => updateUser.GrantedPermissions.Contains(p.Name));

where "updateUser.GrantedPermissions" is a list of string of the checkboxes.

i then call this method

await _userManager.SetGrantedPermissionsAsync(user, permissions);

Which all seems to work fine, i can see a new entry in the database which sets the IsGranted column for that particular permission/user to the correct value. The issue is when i come to load the permissions back up. When i make the call to pull the Permissions out of the database using this method

var grantedPermissions = await _userManager.GetGrantedPermissionsAsync(user);

the newly applied permission does not show. The newly applied permission only shows when i restart the application (in visual studio debug).

So it looks like it is caching the permissions maybe? My question is, is there any caching on permissions? if so, is there anyway i can disable it so it always queries for the latest permissions?

Many Thanks Thomas

@ismcagdas What would define an Id field? If it is just a field named "Id" then i can't think of any that would have duplicates.

Here is a bit of the controller code

[HttpPost]
        [UnitOfWork]
        public virtual async Task<ActionResult> CreateUser(CreateUserViewModel model)
        {
            try
            {
                CheckModelState();

                // Validation code removed 

                // Switch to the tenant
                if (tenant != null)
                {
                    _unitOfWorkManager.Current.EnableFilter(AbpDataFilters.MayHaveTenant);
                    _unitOfWorkManager.Current.SetTenantId(tenant.Id);
                }

                // Add default roles
                user.Roles = new List<UserRole>();
                var roles = await _roleManager.Roles.Where(r => r.IsDefault).ToListAsync();

                if (roles.Any())
                {
                    foreach (var defaultRole in roles)
                    {
                        user.Roles.Add(new UserRole { RoleId = defaultRole.Id });
                    }
                }                

                // Save User
                CheckErrors(await _userManager.CreateAsync(user));
                await _unitOfWorkManager.Current.SaveChangesAsync();


            }
            catch (UserFriendlyException ex)
            {
                ViewBag.ErrorMessage = ex.Message;

                return View("CreateUser", model);
            }
        }

I've removed some validation code at the top as this works. Just on another note as well, if i comment out the code that throws the exception, then another slice of code also throws the same exception

CheckErrors(await _userManager.CreateAsync(user));

Thanks

Question

Hello,

I am running this bit of code from an MVC controller. The method has the UnitOfWork attribute and is virtual,

This is the bit of code where the exception is thrown

var roles = await _roleManager.Roles.Where(r => r.IsDefault).ToListAsync();

This is the exception that is being thrown

System.Reflection.AmbiguousMatchException occurred HResult=-2147475171 Message=Ambiguous match found. Source=mscorlib StackTrace: at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) at System.Type.GetProperty(String name, BindingFlags bindingAttr) at System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName) at Abp.Domain.Repositories.AbpRepositoryBase2.CreateEqualityExpressionForId(TPrimaryKey id) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:line 257 at Abp.Domain.Repositories.AbpRepositoryBase2.FirstOrDefault(TPrimaryKey id) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:line 99 at Castle.Proxies.Invocations.AbpRepositoryBase2_FirstOrDefault_30.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase2Proxy_1.FirstOrDefault(Int32 id) at Abp.Domain.Repositories.AbpRepositoryBase2.Get(TPrimaryKey id) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:line 68 at Castle.Proxies.Invocations.AbpRepositoryBase2_Get_15.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase2Proxy_1.Get(Int32 id) at Abp.MultiTenancy.TenantCache2.GetTenant(Int32 tenantId) in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:line 60 at Castle.Proxies.Invocations.TenantCache2_GetTenant.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.TenantCache2Proxy.GetTenant(Int32 tenantId) at Abp.MultiTenancy.TenantCache2.<>c__DisplayClass4_0.<Get>b__0() in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:line 38 at Abp.Runtime.Caching.TypedCacheExtensions.<>c__DisplayClass0_02.<Get>b__0(TKey k) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheExtensions.cs:line 13 at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass3_02.<Get>b__0(String k) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 28 at Abp.Runtime.Caching.CacheBase.Get(String key, Func2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:line 42 at Abp.Runtime.Caching.CacheExtensions.Get[TKey,TValue](ICache cache, TKey key, Func2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 28 at Abp.Runtime.Caching.TypedCacheWrapper2.Get(TKey key, Func2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheWrapper.cs:line 52 at Abp.Runtime.Caching.TypedCacheExtensions.Get[TKey,TValue](ITypedCache2 cache, TKey key, Func1 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheExtensions.cs:line 13 at Abp.MultiTenancy.TenantCache2.Get(Int32 tenantId) in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:line 0 at Castle.Proxies.Invocations.TenantCache2_Get.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.TenantCache2Proxy.Get(Int32 tenantId) at Abp.Zero.EntityFramework.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(DbPerTenantConnectionStringResolveArgs args) in D:\Halil\GitHub\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\DbPerTenantConnectionStringResolver.cs:line 57 at Abp.Zero.EntityFramework.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(ConnectionStringResolveArgs args) in D:\Halil\GitHub\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\DbPerTenantConnectionStringResolver.cs:line 46 at Abp.Domain.Uow.UnitOfWorkBase.ResolveConnectionString(ConnectionStringResolveArgs args) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:line 332 at Abp.EntityFramework.Uow.EfUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 145 at Abp.EntityFramework.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkExtensions.cs:line 38 at Abp.EntityFramework.Uow.UnitOfWorkDbContextProvider1.GetDbContext(Nullable1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkDbContextProvider.cs:line 38 at Castle.Proxies.EfRepositoryBase2Proxy_3.get_Context_callback() at Castle.Proxies.Invocations.EfRepositoryBase3_get_Context_22.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase2Proxy_3.get_Context() at Abp.EntityFramework.Repositories.EfRepositoryBase3.get_Table() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 30 at Castle.Proxies.Invocations.EfRepositoryBase3_get_Table_22.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase2Proxy_3.get_Table() at Castle.Proxies.EfRepositoryBase2Proxy_3.GetAll_callback() at Castle.Proxies.Invocations.EfRepositoryBase3_GetAll_22.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase2Proxy_3.GetAll() at Abp.Authorization.Roles.AbpRoleStore2.get_Roles() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Authorization\Roles\AbpRoleStore.cs:line 42 at Microsoft.AspNet.Identity.RoleManager2.get_Roles() at Castle.Proxies.Invocations.RoleManager2_get_Roles.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.RoleManagerProxy.get_Roles() at Portal.Web.Areas.Tools.Controllers.UsersController.<CreateUser>d__17.MoveNext() in C:\Users\admin.tom.adams.CTL-PORTAL\Documents\Visual Studio 2015\Projects\Portal\Portal.Web\Areas\Tools\Controllers\UsersController.cs:line 301 InnerException:

Any ideas what could be causing this? Thanks

Resolved after upgrading to v0.9.3.0. Many Thanks

I've done a bit more testing this morning just to try and rule a few things out.

I've setup a brand new EF project (no abp packages installed) and it can pull a list of Contacts out fine.

I've changed the code slightly just to see if it was pulling them all out at the same time that was the issue. Here is the new code.

[UnitOfWork]
        protected override void DoWork()
        {
            //var contacts = _autoTaskContactRepository.GetAllList();

            var totalContacts = _autoTaskContactRepository.Count();
            var pages = Math.Ceiling(Convert.ToDouble(totalContacts)/500);
            var contacts = new List<AutoTaskContact>();

            for (int i = 0; i < pages; i++)
            {
                    contacts.AddRange(_autoTaskContactRepository.GetAll().OrderBy(c => c.AccountID).Skip(i * 500).Take(500));                             
            }


            Debug.WriteLine("{0} Contacts", contacts.Count);
        }

If i loop through the iteration with breakpoints, i can see that it is working, however each loop takes longer and longer to complete. I also fire up sql profiler and i can see the actual sql command completes in no time at all, but the time between each request gets longer and longer.

I can actually get it to run now if i change the code to this

//[UnitOfWork]
        protected override void DoWork()
        {
            //var contacts = _autoTaskContactRepository.GetAllList();

            var totalContacts = _autoTaskContactRepository.Count();
            var pages = Math.Ceiling(Convert.ToDouble(totalContacts)/500);
            var contacts = new List<AutoTaskContact>();

            for (int i = 0; i < pages; i++)
            {
                using (var unitOfWork = _unitOfWorkManager.Begin())
                {
                    contacts.AddRange(_autoTaskContactRepository.GetAll().OrderBy(c => c.AccountID).Skip(i * 500).Take(500));
                    unitOfWork.Complete();
                }
                
            }


            Debug.WriteLine("{0} Contacts", contacts.Count);
        }

but it still takes a relatively long time to complete, 1 minute 34 to bring 9207 records out of sql.

Cheers

Question

Hello,

I seemed to have developed a bit of an issue since updating to abp v0.9.1.1 from 0.8.4.1.

Currently i have this background worker and it throws the following exception

System.Transactions.TransactionAbortedException occurred HResult=-2146233087 Message=The transaction has aborted. Source=System.Transactions StackTrace: at System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState) at System.Transactions.CommittableTransaction.Commit() at System.Transactions.TransactionScope.InternalDispose() at System.Transactions.TransactionScope.Dispose() at Abp.EntityFramework.Uow.EfUnitOfWork.DisposeUow() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 191 at Abp.EntityFramework.Uow.EfUnitOfWork.CompleteUow() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 89 at Abp.Domain.Uow.UnitOfWorkBase.Complete() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:line 239 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 54 at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47 at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35 at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.EfRepositoryBase`3Proxy_18.GetAllList() at Portal.AutoTask.DownloadAutoTaskContactsFull.DoWork() in C:\Users\admin.tom.adams.CTL-PORTAL\Documents\Visual Studio 2015\Projects\Portal\Portal.Application\AutoTask\BackgroundWorkers.cs:line 208 InnerException: HResult=-2146233083 Message=Transaction Timeout InnerException:

Here is the actual background job. As you can see its very simple (just testing at the moment).

public class DownloadAutoTaskContactsFull : PeriodicBackgroundWorkerBase, ISingletonDependency
    {
        private readonly IRepository&lt;AutoTaskContact, long&gt; _autoTaskContactRepository;
        public DownloadAutoTaskContactsFull(AbpTimer timer, IRepository&lt;AutoTaskContact,long&gt; autoTaskContactRepository) : base(timer)
        {
            Timer.Period = 5000;

            _autoTaskContactRepository = autoTaskContactRepository;
        }

        [UnitOfWork]
        protected override void DoWork()
        {
            var contacts = _autoTaskContactRepository.GetAllList();

            Debug.WriteLine("{0} Contacts", contacts.Count);
        }
    }

It seems to be the GetAllList command that throws the exception. Essentially it looks as if its doing nothing for ~15 minutes before throwing the exception.

I've tested with other commands such as SingleOrDefault with a filter and it works fine and returns a result. Through testing it seems to be any list > 1000 records, the table itself only has 9000 records which isn't huge.

I have also tested this with other entities and in the application service layer as well and its the same result (timeout). If i query through sql management studio, then it completes in a tiny amount of time, < 1ms.

As you can see i am using the built in IRepository, not my own. Any suggestions on how to resolve this are appreciated. Thanks

Question

Hello,

just looking for some advice/points on the database context/repositories.

Abp is setup and working fine with a MSSQL database.

We are looking to start querying and updating another database which is MySql. Now this database is already populated with tables and information and its not feasible to change the schema.

I've created the code first classes and setup and new dbcontext.

My question is, is it possible to use the repositories somehow? My code first classes are not inheriting from type Entity, as this would cause a database migration.

Is there another class/interface i can inherit from to still use the repositories?

Any help is appreciated. Thanks

Thanks! I was on the right lines with the modelBuilder but my syntax was slightly off.

Showing 1 to 10 of 17 entries