IdentityMap is a design pattern used for optimizing object look up and maintaining a consistent view of data within a specific context (e.g., a single web request). Martin Fowler's Patterns of Enterprise Application Architecture discusses it in more depth and how it relates to other design patterns.
Questions tagged [identity-map]
27 questions
17
votes
2 answers
IdentitySet / IdentityHashSet (use IdentityHashMap)
I know about IdentityHashMap, but I need to use to something like "IdentitySet" (use equals as o1 == o2 ). I'm going to use one to listen Observable list with "extractor" (JavaFX):
List deleteList = new ArrayList<>();
List addList…

kozmo
- 4,024
- 3
- 30
- 48
10
votes
3 answers
Rails 3.1 Identity Map issues?
Does anyone know the key issues that the Rails 3.1 IdentityMap feature has that has forced the feature to be disabled by default? I'm sure that there are minor specific issues, but are there any major issues that anyone should be aware of before…

matsko
- 21,895
- 21
- 102
- 144
8
votes
2 answers
How to invalidate entity framework 4 internal cache
As I know Entity Framework implements the Identity Map Pattern, so EF caches some entities in the memory.
Let I give you example.
var context = new StudentContext();
var student = context.Students.Where(st => st.Id == 34).FirstOrDefault();
// any…

Ivan Bianko
- 1,749
- 15
- 22
6
votes
2 answers
sqlalchemy identity map question
The identity map and unit of work patterns are part of the reasons sqlalchemy is much more attractive than django.db. However, I am not sure how the identity map would work, or if it works when an application is configured as wsgi and the orm is…

vikash dat
- 1,494
- 2
- 19
- 37
5
votes
2 answers
How to use UnitOfWork pattern together with IdentityMap pattern?
In Martin Fowler's book I read about UnitOfWork and IdentityMap patterns.
Author mentioned that it is a good idea to put identityMap inside the UnitOfWork. But how to do it ?
As far I understood IdentityMap is bounded by session but author doesn't…

gstackoverflow
- 36,709
- 117
- 359
- 710
4
votes
6 answers
Are NHibernate ICriteria queries cached or put in the identity map?
Using NHibernate I usually query for single records using the Get() or Load() methods (depending on if I need a proxy or not):
SomeEntity obj = session.Get(new PrimaryKeyId(1));
Now, if I execute this statement twice, like the example…

TedOnTheNet
- 1,082
- 1
- 8
- 23
4
votes
2 answers
SQLAlchemy get items from the identity map not only by primary key
Is it possible to use a couple of fields not from the primary key to retrieve items (already fetched earlier) from the identity map? For example, I often query a table by (external_id, platform_id) pair, which is a unique key, but not a primary key.…

Ivan Velichko
- 6,348
- 6
- 44
- 90
4
votes
2 answers
What is the best structure to implement an Identity Map?
Although a DataTable is a memory hog, wouldn't a DataTable be the best choice to implement and IdentityMap if the set of objects is very large since retrieval time is O(1)?
Update
If I decide to use IDictionary, do I sacrifice speed when retrieving…

David Robbins
- 9,996
- 7
- 51
- 82
3
votes
1 answer
Why entity framework isn't implement identity map with unit of work?
I have written test code as bellow:
Entities db = new Entities();
var place = new Place
{
Id = Guid.NewGuid(),
Name = "test",
Address = "address"
…

Jekas
- 578
- 4
- 15
2
votes
0 answers
Getting newly added entities from ObjectContext before saving changes
OK, I read these:
EntityFramework show entities before saving changes
Where added objects are stored in ObjectContext?
I guess there is no clear solution of the problem (although the second post is from 2009) but I think it's an important issue of…

Hristo
- 185
- 9
2
votes
2 answers
Where can I find a C# implementation of the "Identity Field" (fowler) pattern that support multiple fields of different types
I've found one that allows multiple fields of type long. However, i'm not sure how useful that is since sometimes we may have Guids or even dates for example.
I could also modify his to support my needs, but this seems like it would be such a common…

Mark
- 5,223
- 11
- 51
- 81
2
votes
1 answer
Ruby implementations of the identity map pattern
I am planning to implement an identity map for a small project which is not using any ORM tool.
The standard implementation in most examples I have seen is just a hash by object id, however it is obvious that the hash will grow without limits. I…

SystematicFrank
- 16,555
- 7
- 56
- 102
2
votes
1 answer
Can I use patterns like identity map in a stateless environment
Szenario:
I have read the book P of EAA by Martin Fowler and stumbled over the pattern called Identity Map. I've thought about using this pattern in an ASP.NET MVC application.
Question:
As far as I know the ASP.NET MVC request life-cycle always…

MUG4N
- 19,377
- 11
- 56
- 83
1
vote
1 answer
Force Entity Framework to return a new instance
We have a scenario in our code when only a few properties of an entity are allowed to be changed. To guarantee that, we have code similar to this:
public void SaveCustomer(Customer customer)
{
var originalCustomer =…

jhu
- 11
- 1
1
vote
0 answers
Storage for DataMappers in ASP.NET WebApplication
In Martin Fowler's "Patterns of Enterprise Application Architecture"
is described approach for organizing DAL like a set of mappers for entities. Each has it's own IdentityMap storing specific entity.
for example in my ASP.NET…

tabalin
- 2,303
- 1
- 15
- 27