[RESOLVED] Unity container and persistence-VBForums
Results 1 to 1 of 1

Thread: [RESOLVED] Unity container and persistence

  1. #1

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,334

    Resolved [RESOLVED] Unity container and persistence

    Following is the code I have in my API classes:

    Code:
                unityContainer.RegisterType<ISecurityManagementService, SecurityManagementService>(new Interceptor<TransparentProxyInterceptor>(), new InterceptionBehavior<PolicyInjectionBehavior>());
    And then there are simple APIs/repositories:

    Code:
                unityContainer.RegisterType<IUserRepository, UserRepository>();
    Service classes are exposed to the client, and so have method attributes to control who can access it and all. Repositories service the requests for data, and in turn use Entity Framework 4.0 as the DAL.

    I want to implement caching at the repository level, so that repeated read requests for the data needn't hit the database every time. For e.g. the UserRepository class has a method as follows:
    Code:
    public IList<User> GetAll()
    {
    ...
    }
    Usually it would fetch the list from the database every time. I want to use caching here to ensure it doesn't go to the database every time. However I notice that the repository objects are not persistent. How do I make them persistent? Alternatively how do I implement caching?

    .


    EDIT
    Found the answer: Lifetimemanagers. Aarghhh!!
    Last edited by honeybee; Dec 21st, 2012 at 07:44 AM. Reason: Stupidity
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.