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

C#

 
Questionexception when serialize binary entity framework objects Pin
Giorgi Nistor9-Feb-12 22:13
Giorgi Nistor9-Feb-12 22:13 
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 
I was able to serialize also with references in this way:
but still I dont understand why when using a DataContractSerializer I am able to serialize also the references since it is mark as xmlIgnore
C#
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("ModelStart", "PlayerHobbie", "Hobbie")]
public EntityCollection<Hobbie> Hobbies
{

let's see when deserializing ...

C#
using (ModelStartContainer model= new ModelStartContainer())
            {
                /*
                Player obj= new Player();
                
                Hobbie o1= new Hobbie();
                o1.Sport = "Tennis";
                obj.Hobbies.Add(o1);

                Hobbie o2 = new Hobbie();
                o2.Sport = "Ski";
                obj.Hobbies.Add(o2);

                obj.Name = "Georgen";
                
                model.Players.AddObject(obj);
                model.SaveChanges();

                 */
 
                try
                {
                    var queryable = model.Players.Include("Hobbies").ToList();

                    using (XmlWriter writer = XmlWriter.Create(@"c:\Serialize\conTemp.xml"))
                    {
                        DataContractSerializer serializer = new DataContractSerializer(queryable.GetType());
                        serializer.WriteObject(writer, queryable);
                    }
                }
                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);
                }
                  
            }

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 
GeneralRe: Loop while mouse or key is down Pin
BillWoodruff9-Feb-12 19:42
professionalBillWoodruff9-Feb-12 19:42 
GeneralRe: Loop while mouse or key is down Pin
V.9-Feb-12 22:52
professionalV.9-Feb-12 22:52 
GeneralRe: Loop while mouse or key is down Pin
BillWoodruff9-Feb-12 20:09
professionalBillWoodruff9-Feb-12 20:09 
GeneralRe: Loop while mouse or key is down Pin
Luc Pattyn9-Feb-12 23:32
sitebuilderLuc Pattyn9-Feb-12 23:32 
GeneralRe: Loop while mouse or key is down Pin
BobJanova10-Feb-12 0:22
BobJanova10-Feb-12 0:22 
GeneralRe: Loop while mouse or key is down Pin
Marcus_211-Feb-12 8:52
Marcus_211-Feb-12 8:52 
GeneralRe: Loop while mouse or key is down Pin
BobJanova9-Feb-12 22:06
BobJanova9-Feb-12 22:06 

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.