Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
QuestionDBConcurrencyException problem Pin
Member 108711908-Jun-14 0:12
Member 108711908-Jun-14 0:12 
AnswerRe: DBConcurrencyException problem Pin
Dave Kreskowiak8-Jun-14 3:06
mveDave Kreskowiak8-Jun-14 3:06 
GeneralRe: DBConcurrencyException problem Pin
Member 108711908-Jun-14 5:11
Member 108711908-Jun-14 5:11 
GeneralRe: DBConcurrencyException problem Pin
Member 108711908-Jun-14 5:14
Member 108711908-Jun-14 5:14 
GeneralRe: DBConcurrencyException problem Pin
Dave Kreskowiak8-Jun-14 14:36
mveDave Kreskowiak8-Jun-14 14:36 
GeneralRe: DBConcurrencyException problem Pin
Member 108711908-Jun-14 23:56
Member 108711908-Jun-14 23:56 
GeneralRe: DBConcurrencyException problem Pin
Member 108711909-Jun-14 1:05
Member 108711909-Jun-14 1:05 
QuestionShare access to a stream, logfile name, and a locker between two classes (objects) Pin
Marco Bertschi6-Jun-14 8:56
protectorMarco Bertschi6-Jun-14 8:56 
As some may know, I'm currently writing my Syslog implementation on C#/.Net.
Since I want to be able to rotate the log files in different manners, I got an interface IWriter[^]. Currently there is only one derived class, FileSizeRotatedWriter[^]. I'm now facing the problem that a class which rotates the Logfiles is non-existent and the FileSizeRotatedWriter does also the Rotation, which is not a really good design. I though about making a class RotationWriter deriving from an interface IRotator, which would make me able to assign any Rotator to the FileSizeRotatedWriter, but stumbled upon several problems:

- Writing to the Log directory is secured by a locking mechanism
- Both the Writer and the Rotator need to know the name of the currently used logfile
- The writer needs to keep the stream to the logfile open as long as possible, since each open/close operation costs time


I thought a bit about each of these problems, and found different solutions.
-- Have a third class which handles the resources
-- Notify the classes of changes by using events [bidirectional]
-- Let the FileSizeRotatedWriter instantiate a new Rotator any time something has changed, or push the changes down by an event [unidirectional]

I'm kinda stuck on this, and maybe need to go out and refresh my head. Any thoughts on this are greatly appreciated.

Edit: The full source code can be found at the Springlog Workspace[^]

The console is a black place

GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
PIEBALDconsult6-Jun-14 18:22
mvePIEBALDconsult6-Jun-14 18:22 
AnswerRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
Gary R. Wheeler7-Jun-14 2:19
Gary R. Wheeler7-Jun-14 2:19 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
Marco Bertschi7-Jun-14 2:33
protectorMarco Bertschi7-Jun-14 2:33 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
OriginalGriff7-Jun-14 3:59
mveOriginalGriff7-Jun-14 3:59 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
Marco Bertschi7-Jun-14 4:26
protectorMarco Bertschi7-Jun-14 4:26 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
OriginalGriff7-Jun-14 4:54
mveOriginalGriff7-Jun-14 4:54 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
Marco Bertschi7-Jun-14 6:14
protectorMarco Bertschi7-Jun-14 6:14 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
PIEBALDconsult7-Jun-14 4:37
mvePIEBALDconsult7-Jun-14 4:37 
GeneralRe: Share access to a stream, logfile name, and a locker between two classes (objects) Pin
Marco Bertschi7-Jun-14 6:11
protectorMarco Bertschi7-Jun-14 6:11 
QuestionNeed to get readable address from latitude and longitude in windows form application using c# Pin
Godwinsmith5-Jun-14 18:54
professionalGodwinsmith5-Jun-14 18:54 
AnswerRe: Need to get readable address from latitude and longitude in windows form application using c# PinPopular
Bernhard Hiller5-Jun-14 20:58
Bernhard Hiller5-Jun-14 20:58 
GeneralRe: Need to get readable address from latitude and longitude in windows form application using c# Pin
Godwinsmith5-Jun-14 23:23
professionalGodwinsmith5-Jun-14 23:23 
QuestionClear ListBox from different class Pin
doby485-Jun-14 13:50
doby485-Jun-14 13:50 
AnswerRe: Clear ListBox from different class Pin
Wes Aday5-Jun-14 14:38
professionalWes Aday5-Jun-14 14:38 
GeneralRe: Clear ListBox from different class Pin
doby485-Jun-14 15:15
doby485-Jun-14 15:15 
GeneralRe: Clear ListBox from different class Pin
doby485-Jun-14 15:46
doby485-Jun-14 15:46 
Questionchat application Pin
Member 107629805-Jun-14 11:15
Member 107629805-Jun-14 11:15 

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.