Base solution for your next web application

Activities of "maharatha"

Thank you. I will go through it. I am definitely waiting for AbpZero where you integrate Swagger UI. It's going to be very useful.

Hi Hilkan-

I am trying to create a documentation for my webAPI. I was going through [http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages]). But i am unsure how do I integrate this to my WebAPI project in Abp zero.

Could you help me with this ?

Thanks, Partha

Thank You Daws. I had gone through this from one of your post in this forum and this is what I would be most likely doing. Do you mind sharing your code which you wrote using the Abp framework. I don't want to implement something which is against the design principle of Abp.

So if you have implemented a custom repository I would appreciate if you could share the code as well.

Thanks much Partha

Hi Halil -

Hope you are doing good. And thank you once again for replying each of my queries. Thanks for bearing me so far. :oops:

I read few of the previous articles on implementing custom repositories but couldn't get a satisfied answer.

I am interested in custom repositories because I would like to call a parameterized stored procedure and get an output from it. I want to write a generic repository to call stored procs and use it wherever I would like.

Any sample code is very much appreciated.

Thanks, Partha

Hi Halil -

I am interested in using the LLBLGen Pro Framework which I understand is not yet integrated with Abp. Is there any scope if you could do this in future.

If not could you guide me on what are the areas I need to watch out for other than Unit Of Work and Repository implementation.

I went through the Abp.EntityFramework code and still analyzing, but if you code guide me in the right direction or approach to start building I will do it and share it with the community.

Thanks, Partha

Thank You for pointing to the right direction.

Finally I did the implementation without adding any new claims. Below is what I did :

Created a Static class containing a static dictionary storing the tenant ID and the DB Connection .

static class ConnectionStrings { static Dictionary<int, string> _dict = new Dictionary<int, string> { {1, @"Server =.\xxxxxx; Database = xxxxxxxx; Trusted_Connection = True;"}, {2, @"Server =.\xxxx; Database = xxxxxxxyyy; Trusted_Connection = True;"},

};

    /// &lt;summary&gt;
    /// Access the Dictionary from external sources
    /// &lt;/summary&gt;
    public static string GetConnectionString(int intTenantID)
    {
        // Try to get the result in the static Dictionary
        string result;
        if (_dict.TryGetValue(intTenantID, out result))
        {
            return result;
        }
        else
        {
            return @"Server =.\xxxxx; Database = cxxxxxxxxx; Trusted_Connection = True;";
        }
    }
}

Then Created a Method called GetDynamicConnectionString()

Was able to access the TenantID using :

var ConnStringClaim = claimsIdentity.Claims.FirstOrDefault(c => c.Type == "http://www.aspnetboilerplate.com/identity/claims/tenantId");

Thank You Hikalkan. You are a savior 8-) . I will be storing the connection string in a DB table and will be getting the connection string from the table and storing in claims,. As the connection string will keep getting added so not sure if I can store that in a static class using dictionary and it would be one connection string per tenant or user. Correct me if I am wrong in my approach ? I am learning a lot of Aspnet Boiler and wants to keep learning.

Secondly I could access the Abpsession using constructor injection but couldn't use it as I wanted the TenantID to be passed as a parameter to GetDynamicConnectionString() which i couldn't. Also I couldn't use the AbpSession.TenantID inside GetDynamicConnectionString() as it's called before the contructor

Lastly, I am unable to find out one common place where I should add my claims because the connection string would change when the host will impersonate. I was trying in AccountController.cs in SaveImpersonationTokenAndGetTargetUrl method for adding and updating claims but when an user impersonates he impersonates as another user. So the claims for impersonated user is null. Basically where should I set claims for impersonated user.

Thanks in advance.

I am now using Claims to store the connection string and using it this way :

public TesTrans(string nameOrConnectionString): base(GetDynamicConnectionString()) { }

    public static string GetDynamicConnectionString()
    {
        var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
        if (claimsPrincipal == null)
        {
            return null;
        }


        var claimsIdentity = claimsPrincipal.Identity as ClaimsIdentity;

        if (claimsIdentity == null)
        {
            return null;
        }

        var ConnStringClaim = claimsIdentity.Claims.FirstOrDefault(c => c.Type == "ConnString");
        if (ConnStringClaim == null || string.IsNullOrEmpty(ConnStringClaim.Value))
        {
            return null;
        }

        return ConnStringClaim.Value;
    }

in my DBContext.

Is this the right way of approach and is there a cleaner and better approach ?

Thank You for the response. Yes if OU are extended more in ASPNET Zero I am sure it would be helpful for everyone in the community.

Showing 311 to 320 of 326 entries