question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to use TypeFinder on Seed?

See original GitHub issue

During the Seed, the following procedure is executed:

private void CreateRolesAndUsers()
        {
            //Admin role
            var adminRole = _context.Roles.FirstOrDefault(r => r.TenantId == _tenantId && r.Name == StaticRoleNames.Tenants.Admin);
            if (adminRole == null)
            {
                adminRole = _context.Roles.Add(new Role(_tenantId, StaticRoleNames.Tenants.Admin, StaticRoleNames.Tenants.Admin) { IsStatic = true });
                _context.SaveChanges();

                //Grant all permissions to admin role
                var permissions = PermissionFinder
                    .GetAllPermissions(new AutoMagazineAuthorizationProvider())
                    .Where(p => p.MultiTenancySides.HasFlag(MultiTenancySides.Tenant))
                    .ToList();

                foreach (var permission in permissions)
                {
                    _context.Permissions.Add(
                        new RolePermissionSetting
                        {
                            TenantId = _tenantId,
                            Name = permission.Name,
                            IsGranted = true,
                            RoleId = adminRole.Id
                        });
                }

                _context.SaveChanges();
            }

The problem is that “AutoMagazineAuthorizationProvider” dont use static authorizations, it uses TypeFinder to find All classes that implements “IPermissionMapper” like AutoMapper.

IOCManager does not resolve TypeFinder and throw this error “No component for supporting the service Abp.Reflection.ITypeFinder was found”

After I registered manually, i can resolve TypeFinder but it throw an exception when i call Find method .

Value cannot be null. Parameter name: items

using (var tf = IocManager.Instance.ResolveAsDisposable<ITypeFinder>())
                {
                    var list = tf.Object.Find(type=> typeof(IPermissionMapper).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract);
....
                 }

Is there a way to use TypeFinder on Seed?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
malimingcommented, Aug 10, 2018

You can upgrade to NET Core + EF Core at the same time. Net 461 is not compatible with NET Core related libraries.

0reactions
vitorlacerdacommented, Aug 9, 2018

Yes. I’m using EF6.

I call seed when execute update-database and when AppWeb Start.

I want to upgrade to EF Core.
Can i use project Net461 with EF Core? I know it is possible but Abp support this? Just changes Abp.EntityFramework to Abp.EntityFrameworkCore, Abp.Zero.EntityFramework to Abp.Zero.EntityFrameworkCore and etc…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to Seedfinding : r/minecraftseeds
Finding seeds starts with imagining the kind of seed you want. Once you have an idea, you can use a seedfinding program or...
Read more >
Fast & Free Enneagram Test
The best way to learn your Enneagram type is to start with our personality test above and then explore the different types that...
Read more >
Know Your Personality Type and Unleash Your Potential
This test has brief information about the careers for your type, but if you main goal is to find the right career for...
Read more >
About the TypeFinder Personality Type Assessment
The TypeFinder is a scientifically validated personality type assessment based upon the theories of Isabel Briggs Myers. The TypeFinder leverages modern ...
Read more >
Minecraft Map Finder
Use Chunkbase To Find The Best Minecraft Seeds, and Locate Biomes and Structures By Ritika Pathak Minecraft's map is one of the biggest...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found