Base solution for your next web application

Activities of "marble68"

Prerequisites

MVC Core version 11.2 Jquery

Status

I have an 11.0 project, and I've merged in 11.2. Everything looks good - but there are new migrations for things like previous passwords ect.

Also - the entity framework versions are different.

Since I'm using mysql, I need to regenerate these migrations and migrate my existing database.

What I tried was merging in my upgraded branch into my existing dev branch without the migration files.

However - I've not been successful at applying the changes.

Firstly, add-migration and update-database return there there is more than one dbcontext and I must specify. When I do, it still does not like the migrations generated.

What is the normal process for this? Am I missing something?

Thanks!

Prerequisites

v11 MVC Core

After spending some hours on creating a widget...

First, it prepends my Filter name as a folder, said it couldn't find my file. So I moved it there.

Then, it looked for it in the widgets folder, where I had it, and said it couldn't find it.

Any ideas what might might cause a widget to look in two different places?

Prerequisites

V11.0 Core MVC

This page That walks through creating a widget seems a bit out of date.

Is there a fresher walkthrough somewhere?

I'm about to do my third walkthrough to try and get a widget to show up! lol

Thanks if anyone has a better resource.

Prerequisites

v11 MVC Core

In one of my application services - I need to send a value along with the resulting PagedResultDto.

How can I add a property to the PagedResultDto object?

Since the app service inherits from IApplicationService, I can't just change my service's GetAll return type.

How might I approach this, since I need this data not just in the UI but in the dynamically generated API as well?

Thanks for any suggestions

Prerequisites

V11.0 MVC Core

I created a domain service, and it's called by a background job.

Everything works fine.

I want to log output to the application log file specified in the log4net configuration.

I follow the instructions here: aspnetboilerplate logging documentation as instructed to by documentation here: AspNetZero Core MVC Documentation on logging

I did this:

using Abp.Dependency;
using nameSpace.Surpath.Importing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Castle.Core.Logging;

namespace nameSpace.Surpath.DomainServices
{

    public class ImportClientFromSPLService : nameSpaceServiceBase, IImportClientFromSPLService, ISingletonDependency
    {
        public ILogger Logger { get; set; }

        public bool CanImport { get; set; } = true;

        public ImportClientFromSPLService()
        {
            Logger = NullLogger.Instance;

        }

        public async Task<bool> DoImport(JobArguments args)
        {
            if (CanImport)
            {
                Logger.Debug($"DoImport called (Starting): client_id= {args.client_id}");
                
                CanImport = false;
                return true;
                Thread.Sleep(10000);
                Logger.Debug($"DoImport called (Finished): client_id= {args.client_id}");
                CanImport = true;
            }
            else
            {
                Logger.Debug($"DoImport called (Busy): client_id= {args.client_id}");
                return false;
            }

        }
    }
}

I run it, my "DoImport" method is called, and nothing is logged in my Logs.txt file.

I'm obviously doing something really silly here, missing something very basic.

Any suggestions why this doesn't work?

Prerequisites

11.0 CORE MVC

I have background job that is pulling data - this is what I'm doing to try and shuffle a considerable amount of data over.

So I have this repeating over and over in the code, making it smell very bad.

I think I've missed something, this seems way too complicated?

Probably the thing to do is refactor this in a service.

Thanks in advance for any tips or tricks!

            using (var uowManager = IocManager.Instance.ResolveAsDisposable<IUnitOfWorkManager>())
                        {
                            using (var permUow = uowManager.Object.Begin())
                            {
                                _context = uowManager.Object.Current.GetDbContext<inzibackendDbContext>(MultiTenancySides.Host);
                                if (_context.Tenants.AsNoTracking().IgnoreQueryFilters().Any(t => t.TenancyName.Equals(_args.NewTenancyName)))
                                    return false;


                                using (var _sessionObj = IocManager.Instance.ResolveAsDisposable<IAbpSession>())
                                {
                                    _session = _sessionObj.Object;
                                    _session.Use(args.TenantId, args.UserId);
                                   //// Business steps here that create the rec object
                                    _context.Records.Add(rec);
                                    _context.SaveChanges();
                                }
                                await permUow.CompleteAsync();
                            }
                        }

Prerequisites

11.0 MVC Core

We have an older system and I'm trying to move customers to the new one.

I am able to get the data, and create entities, etc. However, I made a job that creates the tenant with an admin user via the tenant app service.

Inside the Unit Of Work Im using ISession and telling it to use null as the tenantID and my Id as the user id.

When the Unit Of Work for that is completed, then I then try to set the session to that new tenant id and the id of the created admin user.

I can see the entity in the database.

When I try and create entities (using the entities' app services) - I get exceptions of not authorized.

If I do it as my, it sets the tenant ID to null on the objects.

I'm really struggling to get this to work - any suggestions would be helpful.

Thanks.

Prerequisites

Core MVC v11.0

I have an entity with a file property, which the system puts in appbinaryobjects table.

When getting results, the created service goes and gets each binaryobject and then only uses the description. This is extremely slow.

So I'm doing this:

desc = _binaryObjectRepository.Get(id).Description;

This has helped - is there a better way to do this? I see there's a .Query on the IRepository - but I'm not sure how to use it.

Any faster way you might suggest?

EDIT

I found the best way: desc = _binaryObjectRepository.Query<string>(q => q.Where(r => r.Id == id).Select(r => r.Description).FirstOrDefault());

In the above example, it still seleted all columns. The above generates a query similar to this (mysql):

select a.Descriptions from AppBinaryObjects as a where (false or (a.TenantId=5213)) AND (a.Id = '<guid>') limit 1

Core MVC version 11.0 Using the Power Tool, ffter generating an entity - I get this.

How can I make this go away? What do I need to do to my package.json files? Ultimately, how do I make this go away?

This isn't really a question, just posting this in case anyone needs a solution (and for myself in case I forget and need to do this again).

Basically - when files are uploaded, they're held for a short time in cache, then flushed to the database. This is fine for small files, but if you need large files, or want to encrypt them, etc. there could be a lot of places you have to touch in code.

I have a need to split the storage based on what it is. Profile pics are fine in the database, but what about a large PDF or data you want to encrypt?

As a proof of concept, I tweaked the DbBinaryObjectManager and the BinaryObject, then, instead of returning the IRepsoitory Task directly, I examine the BinaryObject entity which self describes where to find it.

More details can be found here: https://github.com/aspnetzero/aspnet-zero-core/issues/1612

Showing 11 to 20 of 68 entries