Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# code to convert txt to xls Pin
taurusone10-Feb-12 6:11
taurusone10-Feb-12 6:11 
AnswerRe: c# code to convert txt to xls Pin
Eddy Vluggen10-Feb-12 6:48
professionalEddy Vluggen10-Feb-12 6:48 
GeneralRe: c# code to convert txt to xls Pin
jschell10-Feb-12 9:28
jschell10-Feb-12 9:28 
AnswerRe: c# code to convert txt to xls Pin
Richard MacCutchan10-Feb-12 6:38
mveRichard MacCutchan10-Feb-12 6:38 
AnswerRe: c# code to convert txt to xls Pin
Tim Groven10-Feb-12 7:02
Tim Groven10-Feb-12 7:02 
QuestionHow to dynamically change the gradient of a usercontrol according to the values using c# and wpf Pin
Amalrulezz10-Feb-12 0:05
Amalrulezz10-Feb-12 0:05 
AnswerRe: How to dynamically change the gradient of a usercontrol according to the values using c# and wpf Pin
Pete O'Hanlon10-Feb-12 0:15
mvePete O'Hanlon10-Feb-12 0:15 
Questionexception when serialize binary entity framework objects Pin
Giorgi Nistor9-Feb-12 22:13
Giorgi Nistor9-Feb-12 22:13 
Hi
I used Ado.Net entity framework to create a model with just one simple entity which has only one property Name.
So I use the wizard, classes were created fine.
C#
<pre>    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="ModelStart", Name="tableA")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class tableA : EntityObject
    {

--some code here


I have tried to serialize the object I have binary with the code:

using (ModelStartContainer model= new ModelStartContainer())
            {
               // tableA obj= new tableA();
               // obj.Name = "George";

               // model.tableAs.AddObject(obj);
               // model.SaveChanges();

                BinaryFormatter bf = new BinaryFormatter();
                //new MemoryStream();

                try
                {

                    var query = model.tableAs;

                    //var serialObj = query.Parameters;

                    FileStream filestream = new FileStream(@"c:\Serialize\conTemp.dat", FileMode.Create);

                    bf.Serialize(filestream, query);
                    filestream.Close();
                }
                catch (EntitySqlException ex)
                {
                    throw new ApplicationException("The object query failed", ex);
                }
                catch (EntityCommandExecutionException ex)
                {
                    throw new ApplicationException("The object query failed", ex);
                }
                catch (SerializationException ex)
                {
                    throw new ApplicationException("The object graph could not be serialized", ex);
                }
                // } 
            }


My problem is I get Exception
SerializationException

that the object is not marked as serializable, but it is.

{"Type 'System.Data.Objects.ObjectSet`1[[entityMapExample.tableA, entityMapExample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable."}


Where is my mistake here?
AnswerRe: exception when serialize binary entity framework objects Pin
Pete O'Hanlon9-Feb-12 22:45
mvePete O'Hanlon9-Feb-12 22:45 
GeneralRe: exception when serialize binary entity framework objects Pin
Giorgi Nistor9-Feb-12 22:55
Giorgi Nistor9-Feb-12 22:55 
GeneralRe: exception when serialize binary entity framework objects Pin
Pete O'Hanlon9-Feb-12 23:09
mvePete O'Hanlon9-Feb-12 23:09 
GeneralRe: exception when serialize binary entity framework objects Pin
Giorgi Nistor9-Feb-12 23:16
Giorgi Nistor9-Feb-12 23:16 
GeneralRe: exception when serialize binary entity framework objects Pin
karmjit9-Feb-12 23:23
karmjit9-Feb-12 23:23 
GeneralRe: exception when serialize binary entity framework objects Pin
Giorgi Nistor9-Feb-12 23:58
Giorgi Nistor9-Feb-12 23:58 
GeneralRe: exception when serialize binary entity framework objects Pin
Giorgi Nistor10-Feb-12 0:14
Giorgi Nistor10-Feb-12 0:14 
GeneralRe: exception when serialize binary entity framework objects Pin
BobJanova10-Feb-12 0:27
BobJanova10-Feb-12 0:27 
GeneralRe: exception when serialize binary entity framework objects Pin
Giorgi Nistor10-Feb-12 0:45
Giorgi Nistor10-Feb-12 0:45 
QuestionExport to PDF Chinese in pixels Pin
Rchiu2hk9-Feb-12 15:10
Rchiu2hk9-Feb-12 15:10 
AnswerRe: Export to PDF Chinese in pixels Pin
Richard MacCutchan9-Feb-12 22:17
mveRichard MacCutchan9-Feb-12 22:17 
AnswerRe: Export to PDF Chinese in pixels Pin
Rchiu2hk12-Feb-12 15:59
Rchiu2hk12-Feb-12 15:59 
AnswerLoop while mouse or key is down Pin
DerecL9-Feb-12 12:13
DerecL9-Feb-12 12:13 
GeneralRe: Loop while mouse or key is down Pin
Richard Andrew x649-Feb-12 12:17
professionalRichard Andrew x649-Feb-12 12:17 
GeneralRe: Loop while mouse or key is down Pin
BillWoodruff9-Feb-12 19:41
professionalBillWoodruff9-Feb-12 19:41 
GeneralRe: Loop while mouse or key is down Pin
Pete O'Hanlon9-Feb-12 12:18
mvePete O'Hanlon9-Feb-12 12:18 
GeneralRe: Loop while mouse or key is down Pin
raven198529-Feb-12 13:04
raven198529-Feb-12 13:04 

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.