views:

244

answers:

0

I have just created my domain service from my windows mobile application project via the add reference menu. I construct my objects (Report -> ReportEntries, one-to-many) but I find it very hard to persist them. I understand that I will make use of the SubmitChanges(ChangeSetEntry[]) method but my difficulty lies in the construction of this array. Among others which I understand, there are some properties generated for ChangeSetEntry like:

public partial class ArrayOfKeyValueOfstringArrayOfanyTypety7Ep6D1KeyValueOfstringArrayOfanyTypety7Ep6D1

which I don't know what to do with them.

public partial class ArrayOfKeyValueOfstringArrayOfanyTypety7Ep6D1KeyValueOfstringArrayOfanyTypety7Ep6D1 {

        private string keyField;

        private object[] valueField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
        public string Key {
            get {
                return this.keyField;
            }
            set {
                this.keyField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true)]
        public object[] Value {
            get {
                return this.valueField;
            }
            set {
                this.valueField = value;
            }
        }
    }

What should I do at my situation? The Associations' property declaration is the following

public ArrayOfKeyValueOfstringArrayOfintty7Ep6D1KeyValueOfstringArrayOfintty7Ep6D1[] Associations {
            get {
                return this.associationsField;
            }
            set {
                this.associationsField = value;
            }
        }

So, in order for me, to store the associations' information I should do something like that?

public void Submit()
        {
            List<ChangeSetEntry> boChangesToPersist = new List<ChangeSetEntry>();
            boChangesToPersist.Add(new ChangeSetEntry(){ Entity = report, Id=0});
            for (int i=1; i<reportEntries.Count;i++)
            {
                boChangesToPersist.Add(new ChangeSetEntry(){ Entity = boChangesToPersist [ i], Id = i, Associations =  });
            }
            domainService.SubmitChanges(boChangesToPersist.ToArray());
        }

Thank you