Base solution for your next web application

Activities of "tjackadams"

Question

Hello,

i am trying to use the SettingManager in one of my ApplicationService classes. From what i am reading in the documentation, because my class is derived from "ApplicationService" class, there is no need to inject the SettingManager and i just access it like a property. However, whenever i try and access the SettingManager its set to null and therefore it throws and exception whenever i try and access anything.

public class AutoTaskAppService : PortalAppServiceBase , IAutoTaskAppService
    {

        public AutoTaskAppService()
        {

        }

        public ATWSSoapClient AutoTaskConnection()
        {

        // Access the SettingManager
       string test = SettingManager.GetSettingValue(PortalSettingNames.AutoTaskApiUserName);

}
}

Is there a step that i'm missing? Cheers

Answer

Apologies, i just misread the documentation! Its working now, just injected it into the class. Many Thanks

Hello!

Is it possible to update the sample Console Application <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/AbpEfConsoleApp">https://github.com/aspnetboilerplate/as ... ConsoleApp</a> for version 0.8.1?

When i try and run my console application i receive the following error

Message: No component for supporting the service Abp.Threading.BackgroundWorkers.IBackgroundWorkerManager was found Inner Exception: Stack Trace: at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelIn ternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) at Castle.Windsor.WindsorContainer.ResolveT at Abp.Dependency.IocManager.ResolveT at Abp.AbpKernelModule.Shutdown() at Abp.Modules.AbpModuleManager.<ShutdownModules>b__6(AbpModuleInfo sm) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.ShutdownModules() at Abp.AbpBootstrapper.Dispose() at Portal.ConsoleApplication.Program.Main(String[] args) in C:\Users\admin.tom.adams.CTL-PORTAL\Documents\Visual Studio 2015\Projects\Portal\Portal.ConsoleApplication\Program.cs:line 129

It errors on this line bootstrapper.Initialize();

using (AbpBootstrapper bootstrapper = new AbpBootstrapper())
                {
                    // Load logging configuration
                    bootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));
                    bootstrapper.Initialize();
}

Many Thanks

Hello,

i am currently trying to post a form in a partial view using abp.ajax. The actual form posting works fine, and when the form is filled out correct, the success event fires as expected. The problem arises when there is an error in the form, the InclusiveUnits field has a range applied to it (via Data Annotations). When a value is outside of this range the CheckModelState(); throws an exception as expected, however this doesn't get returned wrapped, it gets returned as html.

Here is the javascript

var form = $("#UpdateForm");

       abp.ajax({
                url: form.attr("action"),
                data: JSON.stringify({
                    accountId: $("#AccountId").val(),
                    accountName: $("#AccountName").val(),
                    contractName: $("#ContractName").val(),
                    serviceName: $("#ServiceName").val(),
                    repositoryId: $("RepositoryId").val(),
                    inclusiveUnits: $("#InclusiveUnits").val(),
                    autoTaskUnits: $("#AutoTaskUnits").val()
               
                })
            })
            .done(function(response) {
                abp.message.success("success");
            })
            .fail(function (response) {
                abp.ajax.showError(response);
                abp.ajax.logError(response);
            });
    });

When the call is successful i receive this response

{
  "success": true,
  "result": {
    "contractId": 39
  },
  "error": null,
  "unAuthorizedRequest": false
}

however when it fails i get a html page that starts with the following

Form is not valid. Please check and fix errors.

I have checked and i am running the latest version of ABP v8.4.0. Is there an issue with the way i am trying to display the validation errors or could this be a bug?

Any help is much appreciated. Tom

Yes it is, here is Controller

[HttpPost]
        public async Task<JsonResult> UpdateCloudRepositoryContract(SplaVeeamCloudRepositoryContractUpdateViewModel model)
        {
            CheckModelState();

            DoStuf();

            return Json(new {ContractId = model.Id});
        }

Thanks

Github issue raised

<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/997">https://github.com/aspnetboilerplate/as ... issues/997</a>

Many Thanks!

Hello,

Is it possible to switch off the Identity Column for the provided Entities such as Tenants? We are looking to pre-populate the Tenants table with Id, TenancyName and Name from another table within our database but we would like to retain the existing Id's if possible.

I have tried editing the OnModelCreating method, which seems to work fine for Entities i have created myself, but not for the Tenant Entity.

If you can let me know if this is possible or just point me in the right direction that would be great. Thanks

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

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

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

Showing 1 to 10 of 17 entries