Using a summary view and the detail tables it draws on

3 posts, 0 answers
  1. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 09 May 2011 Link to this post

    I have a StockInventoryTransactions table, that lists individual inventory transactions. I also have (in the database) a CurrentLevels view that summarizes them by StockID. I definitely want the summarizing to happen on the sql server, not in LINQ; when there are thousands of transactions, you only want to pull down one summary row.

    The trouble is, if I add a new transaction to StockInventoryTransactions, and commit it, the CurrentLevels view does not reflect the change. ORM doesn't realize that this view depends on a table that has been just modified, and that any cached data is no longer valid.

    Is there some way I can flag this view as volatile?

    Backend database is MS Sql Server 2008 R2.  OpenAccess version is 2009.3.111, with reverse mapping.  Yes, this is old.  No, I would rather not take the time and risk to upgrade right now.
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 13 May 2011 Link to this post

    Hi Ross Presser,

     Have you enabled the 2nd Level Cache? You can specify that instances of the class mapped to the view are not cached by adding the following entry to the app.config
    <namespace name="BusinessObjects">
        <class name="MappedToView">
            <extension key="cache-strategy" value="no" />
        </class>
    </namespace>

    You can find more information about the mapping entries, here and here. You can also manually evict the instances from the cache whenever you know the cached data is no longer valid by using the Database.Cache.EvictAll method.

    Do get back in case you need further assistance.

    Greetings,
    Ady
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
  3. DevCraft banner
  4. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 02 Jun 2011 Link to this post

    No, I have not enabled 2nd level cache. This is about the primary cache. I will try using scope.Evict to get the data out of memory.
Back to Top