Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: IBasicVideo + NullRenderer ( How ? ) Pin
MicroVirus8-Sep-11 13:28
MicroVirus8-Sep-11 13:28 
GeneralRe: IBasicVideo + NullRenderer ( How ? ) Pin
semixor9-Sep-11 3:20
semixor9-Sep-11 3:20 
QuestionDeep Linking between views when using PRISM Pin
Phillip Donegan7-Sep-11 21:46
Phillip Donegan7-Sep-11 21:46 
QuestionEF Repository Questions Pin
Matt U.7-Sep-11 11:00
Matt U.7-Sep-11 11:00 
GeneralRe: EF Repository Questions Pin
PIEBALDconsult7-Sep-11 18:10
mvePIEBALDconsult7-Sep-11 18:10 
GeneralRe: EF Repository Questions Pin
Matt U.8-Sep-11 2:35
Matt U.8-Sep-11 2:35 
GeneralRe: EF Repository Questions Pin
PIEBALDconsult8-Sep-11 3:10
mvePIEBALDconsult8-Sep-11 3:10 
AnswerRe: EF Repository Questions Pin
BobJanova8-Sep-11 3:40
BobJanova8-Sep-11 3:40 
I haven't used Repository as an Official Pattern (TM), so this might be completely barking up the wrong tree. Feel free to ignore if so (actually, better to comment and tell me :P). But as I understand it, a repository is essentially a local (i.e. in memory within the client process) cache of entities which have been loaded from the database. It's also a writeable cache (so you can save entities to it, and some time later, they get fully persisted).

They are useful when the data is:

  • For a reading repository:

    • Non volatile, i.e. they don't change very often. A cache that has to refresh every request is no use.
    • Large. You still have to check whether there's been a change (usually involves adding more to the data source and a small amount of overhead), so the cached data needs to be large enough that the request for 'has it changed' isn't as much effort as just getting the data would be. Note that this generally means that you can't cache at the single entity (i.e. one row) level, as finding out if a row changed is as heavy as just returning the row, unless the row is very large and bandwidth to the database is an issue. (If you don't care if your information is out of date, you don't need to ask the DB and you can ignore this. But usually you do care.)

  • For a writable repository:

    • Not shared between processes, or not synchronisation-critical. There's no point having a write-back cache if you have to invalidate it immediately to synchronise the data with another process. However, if you are updating things frequently, and don't need every change to commit to the database immediately, you can save a lot of database updates.



They're also useful if database access is expensive, and your client is the only consumer (so you don't need to worry about synchronisation and changes occuring from elsewhere while you're running). In that case you can use a repository as a local cache of the database and only ever have to read any particular item once.
GeneralRe: EF Repository Questions Pin
Matt U.8-Sep-11 4:37
Matt U.8-Sep-11 4:37 
QuestionBetter Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace7-Sep-11 7:59
NickPace7-Sep-11 7:59 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Pete O'Hanlon7-Sep-11 8:08
mvePete O'Hanlon7-Sep-11 8:08 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Ennis Ray Lynch, Jr.7-Sep-11 8:08
Ennis Ray Lynch, Jr.7-Sep-11 8:08 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
BillWoodruff7-Sep-11 19:37
professionalBillWoodruff7-Sep-11 19:37 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Dan Mos7-Sep-11 8:14
Dan Mos7-Sep-11 8:14 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace7-Sep-11 9:12
NickPace7-Sep-11 9:12 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Matt U.7-Sep-11 11:02
Matt U.7-Sep-11 11:02 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace7-Sep-11 12:42
NickPace7-Sep-11 12:42 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Matt U.7-Sep-11 13:12
Matt U.7-Sep-11 13:12 
QuestionRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
MicroVirus8-Sep-11 4:34
MicroVirus8-Sep-11 4:34 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Abhinav S7-Sep-11 8:26
Abhinav S7-Sep-11 8:26 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Ian Shlasko7-Sep-11 10:06
Ian Shlasko7-Sep-11 10:06 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
PIEBALDconsult7-Sep-11 14:25
mvePIEBALDconsult7-Sep-11 14:25 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
Mehdi Gholam7-Sep-11 20:05
Mehdi Gholam7-Sep-11 20:05 
AnswerRe: Better Way to Search for a Value in a List of KeyValuePairs??? [modified] Pin
BillWoodruff7-Sep-11 20:38
professionalBillWoodruff7-Sep-11 20:38 
GeneralRe: Better Way to Search for a Value in a List of KeyValuePairs??? Pin
NickPace8-Sep-11 3:40
NickPace8-Sep-11 3:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.