This blog is a knowledge base...where I clip cool tricks and urls

Session state with Postgre

clipped from www.codeproject.com
The sample Solution has two projects. The SessionProviders project contains the providers and dependencies. The TestSessionProviders project is the web site I used for testing. The default page has various inputs to place into the Session State. One button places the inputs into Session State. Another button on the default page reads the values from Session State and displays them on the screen. Another button gracefully shuts down the application on the server receiving the request. One link on the default page takes the user to a page where it reads the Session State in the read-only mode. The read-only page has a button to retrieve the values in Session State. Another link on the default pages takes the user to a page where it does not need the Session State. The last link takes the user to a page where
 blog it

HttpSessionState is sealed

clipped from blogs.telerik.com
I already knew that the HttpSessionState instance was being stored in the current HttpContext's Items collection (thanks to Mr. Lutz Roeder, of course), and my initial plan was to inherit from HttpSessionState and intercept the calls made to methods like Add, Remove, etc.  Alas, HttpSessionState is marked as sealed, and none of its methods is virtual.

And then I found it!  Every HttpSessionState object takes a storage parameter on its creation -- an IHttpSessionState implementor.  All I had to to was create an object that implements this interface, and pass it to a new HttpSessionState instance.  My interface implementation simply delegates everything to the real HttpSessionState instance.  Here is how to replace the built-in session object.  Note that we need some reflection to call the internal constructor:
 blog it

ORM caching tier

clipped from blogs.msdn.com

The idea about lazy loading (always) leading to performance degradation is incorrect. It depends on the requirements and the implementation by the developer.

If you're designing an API for 3rd party users (where each unique request to the API is served through e.g. a context), it may be appropriate to allow the context to navigate the object graph and retrieve objects that were modified (even deleted) post the creation of the current context - but when the context attempts to change data, the context is aware of stale data (i.e. by comparing timestamps or a corresponding mechanism).

For ASP.NET applications, the above pattern works quite well because you'd usually want the benefits of lazy loading (for performance issues and memory pressure) as well as allowing the particular request to complete without sporadic null references (i.e. when navigating Order > Customer where the customer entity may have been deleted post the creation of the current context).

 blog it

Object Spaces news

clipped from my.execpc.com
Microsoft .NET
ObjectSpaces are a set of classes and interfaces that enable you to
treat data as an object (or objects), independent of the underlying
data store used by an application. ObjectSpaces builds on and
contains a set of new data access APIs within the Microsoft .NET
Framework to provide access to relational data sources such as
Microsoft SQL Server®, OLE DB data sources, etc.

Get data as objects from a data source using a particular query
criteria

Navigate one-to-many or one-to-one relationships using the objects
returned

Modify the values/properties of the objects

Resolve changes back to the data source

You can use the ObjectSpaces to perform the following data related
tasks/steps:
 blog it

ORM Objects Spaces

Investigate....!

ObjectSpaces and other OR mapping tools has it's own implementation and
features, but basically they all do the same for you. It lets you map the
properties and fields of your business objects directly to your database
tables, columns and views.   It is a framework that lets you totally avoid
SQL and stored procedures. All of your data is transferred between objects and
data sources transparently. That means that you can concentrate on writing
business logic, not database access code. Your business objects doesn't
directly depend on the datasource. It eliminates the need to embed SQL
statements into business layer code and separates the business layer from
database provider and schema changes which improves maintainability.
 blog it

Dynamic Proxy - MultiCast delegates

Too bad the article is in Chinese ....
clipped from www2.cnblogs.com
namespace Castle.DynamicProxy
{
  
using System;

  [Serializable]
  
public class StandardInterceptor : IInterceptor
  
{
    
public StandardInterceptor(){}
    
protected virtual void PreProceed(IInvocation invocation, params object[] args){}
    
protected virtual void PostProceed(IInvocation invocation, ref object returnValue, params object[] args){}

    
public virtual object Intercept(IInvocation invocation, params object[] args)
    
{
      PreProceed(invocation, args);
      
object retValue = invocation.Proceed( args );
      PostProceed(invocation, 
ref retValue, args);
      
return retValue;
    }

  }

}
 blog it