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

C#

 
AnswerRe: connect to access database Pin
OriginalGriff22-Apr-12 3:54
mveOriginalGriff22-Apr-12 3:54 
GeneralRe: connect to access database Pin
Wes Aday22-Apr-12 5:47
professionalWes Aday22-Apr-12 5:47 
AnswerRe: connect to access database Pin
Richard MacCutchan22-Apr-12 4:00
mveRichard MacCutchan22-Apr-12 4:00 
GeneralRe: connect to access database Pin
MemberDotNetting22-Apr-12 4:14
MemberDotNetting22-Apr-12 4:14 
GeneralRe: connect to access database Pin
Dave Kreskowiak22-Apr-12 5:45
mveDave Kreskowiak22-Apr-12 5:45 
GeneralRe: connect to access database Pin
Enhakiel26-Apr-12 9:17
Enhakiel26-Apr-12 9:17 
QuestionQuestions about saving objects and databases Pin
larsp77722-Apr-12 0:13
larsp77722-Apr-12 0:13 
AnswerRe: Questions about saving objects and databases Pin
Keith Barrow22-Apr-12 0:49
professionalKeith Barrow22-Apr-12 0:49 
larsp777 wrote:
In the old program we saved to disc in a binary-file.
 
How would you
do it in C#?

The direct "translation" is .net serialization[^]. You don't need to use the binary formatter described, there is an XML one too (and a SOAP one, but the isn't useful in this context) or you could write your own. Note that it (the binary one) almost certainly won't deserialize the Java files properly.

Personally, I wouldn't store anything "complicted" (say with relations or mutliple rows) this way unless I had really good reasons to. You mention LINQ, "LINQ to SQL" and "Entity Framework" are good ways of persisting data and are similar to eachother. You should Google these. A third (non-Microsofty) option is NHibernate, it has similarities to the Entity Framework, but comes with the added advantage, from your point of view, that there is a Java Equivalent ("Hibernate") so by learning one, you learn the Java version (mod any documented differences).


larsp777 wrote:
I final question is if It is a good design or if it would have been better to
man a traditional relationship database with no objects.

If I understand you correctly, I'd always go for proper relational design, but that doesn't mean you lose good OO at all. The Entity Framework pretty much expects proper relational design (if you design the DB first, it creates well normalised Schema from an OO model if you start with the model first). NHibernate works better under a properly normalised DB too, but is more forgiving of mismatches between the OO and the DB. That said the same things that drive good OO desgin tend to drive DB schemas: A type is pretty much a table, a property to a simple type pretty much a field and a property to a custom class a relationship to another table. Many-to-One maps to a list property at one end and a single property at the other, Many-to-many has maps to lists at both ends.

My advice is to try Entity Framework, starting with the model. Some people have reported performance problems on large data sets, but you can pre-compile LINQ queries and even go the whole hog and use Stored Procs so the perforance is comparable with a little work and you gain more than you lose IMO.


modified 22-Apr-12 6:59am.

GeneralRe: Questions about saving objects and databases Pin
larsp77722-Apr-12 1:50
larsp77722-Apr-12 1:50 
AnswerRe: Questions about saving objects and databases Pin
jschell23-Apr-12 10:58
jschell23-Apr-12 10:58 
QuestionHow to detect if a *.bmp files is modificated in Paint? Pin
amx_tiger21-Apr-12 20:30
amx_tiger21-Apr-12 20:30 
AnswerRe: How to detect if a *.bmp files is modificated in Paint? Pin
Pete O'Hanlon21-Apr-12 20:36
mvePete O'Hanlon21-Apr-12 20:36 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
amx_tiger21-Apr-12 20:51
amx_tiger21-Apr-12 20:51 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Pete O'Hanlon21-Apr-12 22:56
mvePete O'Hanlon21-Apr-12 22:56 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
amx_tiger21-Apr-12 23:25
amx_tiger21-Apr-12 23:25 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Pete O'Hanlon22-Apr-12 3:07
mvePete O'Hanlon22-Apr-12 3:07 
AnswerRe: How to detect if a *.bmp files is modificated in Paint? Pin
Richard MacCutchan21-Apr-12 21:30
mveRichard MacCutchan21-Apr-12 21:30 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
amx_tiger21-Apr-12 21:47
amx_tiger21-Apr-12 21:47 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Richard MacCutchan21-Apr-12 21:59
mveRichard MacCutchan21-Apr-12 21:59 
GeneralMessage Removed Pin
21-Apr-12 22:18
amx_tiger21-Apr-12 22:18 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Richard MacCutchan22-Apr-12 0:51
mveRichard MacCutchan22-Apr-12 0:51 
AnswerRe: How to detect if a *.bmp files is modificated in Paint? Pin
Eddy Vluggen22-Apr-12 1:51
professionalEddy Vluggen22-Apr-12 1:51 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
amx_tiger22-Apr-12 2:07
amx_tiger22-Apr-12 2:07 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Eddy Vluggen22-Apr-12 2:18
professionalEddy Vluggen22-Apr-12 2:18 
GeneralRe: How to detect if a *.bmp files is modificated in Paint? Pin
Richard MacCutchan22-Apr-12 2:29
mveRichard MacCutchan22-Apr-12 2:29 

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.