Click here to Skip to main content
15,887,881 members
Home / Discussions / C#
   

C#

 
GeneralRe: remove items from Listbox Pin
scottichrosaviakosmos12-Sep-12 20:55
scottichrosaviakosmos12-Sep-12 20:55 
GeneralRe: remove items from Listbox Pin
Eddy Vluggen12-Sep-12 21:17
professionalEddy Vluggen12-Sep-12 21:17 
Questionhow to find all elements of a webpage Pin
hosseinDolat9-Sep-12 1:09
hosseinDolat9-Sep-12 1:09 
AnswerRe: how to find all elements of a webpage Pin
jschell9-Sep-12 4:04
jschell9-Sep-12 4:04 
GeneralRe: how to find all elements of a webpage Pin
hosseinDolat9-Sep-12 15:53
hosseinDolat9-Sep-12 15:53 
GeneralRe: how to find all elements of a webpage Pin
jschell10-Sep-12 8:48
jschell10-Sep-12 8:48 
GeneralRe: how to find all elements of a webpage Pin
hosseinDolat10-Sep-12 14:36
hosseinDolat10-Sep-12 14:36 
GeneralRe: how to find all elements of a webpage Pin
jschell11-Sep-12 8:28
jschell11-Sep-12 8:28 
QuestionDatagridview Empty space Click Events Pin
mohammadkaab9-Sep-12 0:57
mohammadkaab9-Sep-12 0:57 
AnswerRe: Datagridview Empty space Click Events Pin
Alan N9-Sep-12 3:19
Alan N9-Sep-12 3:19 
QuestionWindows 7 Files Explorer - New Folder In Tree Pin
fakir4458-Sep-12 22:57
fakir4458-Sep-12 22:57 
AnswerRe: Windows 7 Files Explorer - New Folder In Tree Pin
Eddy Vluggen9-Sep-12 0:29
professionalEddy Vluggen9-Sep-12 0:29 
GeneralRe: Windows 7 Files Explorer - New Folder In Tree Pin
fakir4459-Sep-12 5:14
fakir4459-Sep-12 5:14 
GeneralRe: Windows 7 Files Explorer - New Folder In Tree Pin
Eddy Vluggen9-Sep-12 5:35
professionalEddy Vluggen9-Sep-12 5:35 
GeneralRe: Windows 7 Files Explorer - New Folder In Tree Pin
fakir4459-Sep-12 9:24
fakir4459-Sep-12 9:24 
QuestionIs it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
Mohammad Dayyan8-Sep-12 21:52
Mohammad Dayyan8-Sep-12 21:52 
QuestionRe: Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
Eddy Vluggen9-Sep-12 0:26
professionalEddy Vluggen9-Sep-12 0:26 
AnswerRe: Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
Mohammad Dayyan9-Sep-12 0:52
Mohammad Dayyan9-Sep-12 0:52 
AnswerRe: Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
Eddy Vluggen9-Sep-12 1:12
professionalEddy Vluggen9-Sep-12 1:12 
AnswerRe: Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
jschell9-Sep-12 4:24
jschell9-Sep-12 4:24 
Mohammad Dayyan wrote:
<layer>Repository Pattern



Repository Pattern is just applying a new name to an old idiom - a database layer. And yes you should have a database layer.


Mohammad Dayyan wrote:
with Singleton to have the same DbContext in each entity's instance?


Is is ok to use a Singleton? I doubt it.


(from your other post...)


otherwise, for each entity we have to write Update, Delete, Insert,
Reposit


Not sure what you think you are doing but you are going to need to do that regardless.


Mohammad Dayyan wrote:
<layer>Static class is an instance for all, and it has the same position in RAM of system.
but Singleton has a static field and we can have different instances of our class, but we prevent coupling


As stated that is basically all wrong.

First classes, not data, all exist as a single instance (again the class and not the class instance) in memory excluding AppDomains.

Second in modern OSes the OS moves applications, everything including data, code and OS management stuff associated with application around all the time including moving it to the hard drive. So it can never be said to be in one place in the RAM.

Third class instances (not the class this time) are managed by the C# heap and it can move them around in memory. So it won't even be in the same place in virtual memory.

Fourth, although a Singleton has a rigid definition the conceptual idea of a 'single' instance can take many forms, including implementing access via a static class.

Fifth, none of that has anything to do with coupling.


I suspect that you should at least first attempt to write the Repository code. AFTER you complete that then you can consider the following
1. Are threads involved?
2. Is there any point to using a singleton?

If the answer to the first is no and the answer to the second is yes then you can use a singleton.
GeneralRe: Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ? Pin
Mohammad Dayyan27-Sep-12 2:26
Mohammad Dayyan27-Sep-12 2:26 
QuestionC# scheduled jobs Pin
dcof8-Sep-12 16:46
dcof8-Sep-12 16:46 
AnswerRe: C# scheduled jobs Pin
PIEBALDconsult8-Sep-12 19:08
mvePIEBALDconsult8-Sep-12 19:08 
AnswerRe: C# scheduled jobs Pin
jschell9-Sep-12 4:27
jschell9-Sep-12 4:27 
QuestionC# directory folder levels Pin
dcof8-Sep-12 16:45
dcof8-Sep-12 16:45 

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.