Base solution for your next web application

Activities of "papinaser"

Hi . For a thrid party component I need to pass RoleProvider of my application to it for some initialization. and this RoleProvider must inherent from System.Web.Security.RoleProvider . Has Abp any class for this purpose ?

<cite>mhdbaz: </cite>

<cite>hikalkan: </cite> Hi,

Since this topic is asked by also other people, I decided to prepare a simple running application. Download it from here: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/Others">https://github.com/aspnetboilerplate/as ... ter/Others</a>

I created 2 different DbContext and 2 different migrations in same project. See migration command reference: <a class="postlink" href="http://coding.abel.nu/2012/03/ef-migrations-command-reference/">http://coding.abel.nu/2012/03/ef-migrat ... reference/</a>

I added a new connection string named 'Second':

<add name="Default" connectionString="Server=localhost; Database=MultipleDbContextDemo; Trusted_Connection=True;" providerName="System.Data.SqlClient" />
   <add name="Second" connectionString="Server=localhost; Database=MultipleDbContextDemoSecondDb; Trusted_Connection=True;" providerName="System.Data.SqlClient" />

Then Added second db context:

public class MySecondDbContext : AbpDbContext
   {
       public virtual IDbSet<Course> Courses { get; set; }

       public MySecondDbContext()
           : base("Second")
       {
           
       }
   }

Then enabled migrations:

Enable-Migrations -MigrationsDirectory "MigrationsSecond" -ContextTypeName "MySecondDbContext"

When using add-migration and update database, we use configuration type name, like:

Update-Database -ConfigurationTypeName "MultipleDbContextDemo.MigrationsSecond.Configuration"

An application services both dbcontext (over 2 repositories):

public class TestAppService : MultipleDbContextDemoAppServiceBase, ITestAppService
   {
       private readonly IRepository<Person> _persons;
       private readonly IRepository<Course> _courseRepository;

       public TestAppService(IRepository<Person> persons, IRepository<Course> courseRepository)
       {
           _persons = persons;
           _courseRepository = courseRepository;
       }

       public List<string> GetFromFirstDb()
       {
           var peopleNames = _persons.GetAllList().Select(p => p.PersonName).ToList();
           return peopleNames;
       }

       public List<string> GetFromSecondDb()
       {
           var courseNames =  _courseRepository.GetAllList().Select(p => p.CourseName).ToList();
           return courseNames;
       }

       public List<string> GetFromBothDbs()
       {
           List<string> names = new List<string>();

           var peopleNames = _persons.GetAllList().Select(p => p.PersonName).ToList();
           names.AddRange(peopleNames);

           var courseNames = _courseRepository.GetAllList().Select(p => p.CourseName).ToList();
           names.AddRange(courseNames);

           return names;
       }
   }

Note that: GetFromBothDbs() may not work. You should start Distributed Transaction Coordinator windows service..

For details, see source codes. After downloading solution, first create 2 databases using following commands:

Update-Database -ConfigurationTypeName "MultipleDbContextDemo.Migrations.Configuration"

Update-Database -ConfigurationTypeName "MultipleDbContextDemo.MigrationsSecond.Configuration"

I hope this help you.

Hello Halil I was reading about unit of work and How aspnetboilerplate automatically start a transaction on calling any Application Service method here <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Unit-Of-Work">http://aspnetboilerplate.com/Pages/Docu ... it-Of-Work</a> Do you mean that Starting the MSDTC on the server will fix the issues regarding starting Two transaction ? Dose aspnetboilerplate unit of work deal with this scenarios where multi tenant application should use different database for each tenant ? Please help because I am new to aspnetboilerplate and I also should use Single Application/Multi Database approach.

My scenario is Single Deployment - Multiple Database in the below link I just want to make sure that aspnetboilerplate work with Single Deployment - Multiple Database or How I should implement my Application Service classes in order to get aspnetboilerplate works with Single Deployment - Multiple Database <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy">http://aspnetboilerplate.com/Pages/Docu ... ti-Tenancy</a>

Thank you

I have same problem too.please help me about how to have single development with multi database? (Each database is for some features of my application)

Thankyou

Hi. After Shutdown my pc and come back for runnig my project I have this error: Current user did not login to the application!

if (!AbpSession.UserId.HasValue)
       {
          throw new AbpAuthorizationException(LocalizationManager.GetString(AbpConsts.LocalizationSourceName, "CurrentUserDidNotLoginToTheApplication"));
       }

I clear browser cash but same error again. Thank you.

Hi. Thank you . my problem solved by using DI and your default awesome classes for DI framework. But this is another problem , running this block of code :

var menuGroups = await _menuGroupRepository
                .GetAll()
                .OrderByDescending(e => e.MenuOrderNO).ToListAsync();

is very slow and sometimes project fails. Can you help me about this.

Hi. How I should use AppService Class defined in Application Layer in MVC Web Project? Exactly my problem is constrictor of AppService that take a IRepository as parameter.

[AbpAuthorize]    
    public class MenuGroupAppService: WebUIAppServiceBase, IMenuGroupAppService
    {
        private readonly IRepository<MenuGroup> _menuGroupRepository;   
                 
        public MenuGroupAppService(IRepository<MenuGroup> menuGroupRepository)
        {
            _menuGroupRepository = menuGroupRepository;
        }        

        public IQueryable<MenuGroup> GetAllCreateMenuGroupInputs()
        {
            return _menuGroupRepository.GetAll();
        }

        public async Task<ListResultOutput<MenuGroupListDto>> GetList(GetMenuGroupListInput input)
        {
            var menuGroups = await _menuGroupRepository
                .GetAll()
                .OrderByDescending(e => e.MenuOrderNO).ToListAsync();

            return new ListResultOutput<MenuGroupListDto>(menuGroups.MapTo<List<MenuGroupListDto>>());
        }
    }

and in controller how I should use MenuGroupAppService class for get list of menu groups ?

[HttpGet]
        public List<GetMenuGroupListInput> GetAllMenuGroups()
        {
           
            return new MenuGroupAppService(WHAT I SHOULD PASS HERE?).
            GetList(new GetMenuGroupListInput {JustEspMenus = true});

        }

Thakyou.

THANKS a lot solved by change Discriminator value to RolePermissionSetting.

Hi. I clean and rebuild my web project but same problem again. these attached files are the images of tables. I don't know how share cache permissions ... thank you.

<cite>hikalkan: </cite> Have you read all documents:

  • Authorization: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Authorization">http://www.aspnetboilerplate.com/Pages/ ... horization</a>
  • Role management: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Zero/Role-Management">http://www.aspnetboilerplate.com/Pages/ ... Management</a>

I think I can not explain it in more detail. If you have specific question, you can ask.

Yes, I read these documents and I use module zero template for my project. But when I add a Role and set this for my user manually in db (AbpRoles,AbpUserRoles tables)
Then I set for that role ,one of my project permissions manually in db (AbpPermissions table) In my controller method I use PermissionChecker.Authorize("TestPer") for check user permission. I have Required permissions are not granted. At least one of these permissions must be granted: TestPer ERROR. I clear browser cache but same error again. I trace my code and abp code and abp.zero code, finally I found that in method GetPermissionsAsync(int roleId) of abpRoleStore class (AbpZero Project) , this code : _rolePermissionSettingRepository.GetAllListAsync return 0 count always. can you help me about this problem. thanks you.

<cite>klainer: </cite> SOLVED by await before every async CALL :D :) I got DEDLOCK,more info: <a class="postlink" href="http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html">http://blog.stephencleary.com/2012/07/d ... -code.html</a>

Hi. I cann't understand permission and role in abp Module Zero . I have your problem too. Can you get me information about how permission and roles works based on abp Module Zero? Thanks you

Question

Hi Is there any full sample based on module zero for download. I need to work with permissions , roles , users, validations, crud and etc..., that is based on abp module zero framework. Thanks.

Showing 1 to 10 of 11 entries