tags:

views:

622

answers:

4

Every time that I change a value in the designer after saving it, the .designer.cs file will be deleted.

Can anyone tell me how can I fix this problem?

A: 

This is by design.

leppie
By design you mean we should not use the tool? Cause I was using it before and there wasn't any problems and now suddenly a problem which is "by design" happens.
Mohammadreza
+2  A: 

Don't place your own code in the designer file, instead use a separate file leveraging the partial classes concept.

FlySwat
I thinks this should solve the problem but I have 2 other dbml files which I wrote my code in their code files and there is no problem but since yesterday every new dbml files has it.
Mohammadreza
+3  A: 

The *.designer.cs files are completely generated by designer. You should not write any your own code into this file. The classes and/or methods are partial, so you can extend/change the behaviour in the separate file.

TcKs
+9  A: 

Move 'using' directives in your DataContext.cs and DataContext.designer.cs files into the 'namespace' definition.

gius