Beispiel #1
0
        /// <summary>
        /// Apply synchronisation local to the specified object.
        /// </summary>
        /// <param name="synchronised">
        /// The synchronised object.
        /// </param>
        /// <param name="store">
        /// The synchronisation store for the object.
        /// </param>
        /// <param name="authoritative">
        /// Whether this is an authoritative synchronisation.
        /// </param>
        public void Apply(ISynchronised synchronised, SynchronisationStore store, bool authoritative)
        {
            /*
             * TODO Use type information in synchronisation engine
             *
             * We don't yet use the type information on the synchronisation store
             * for anything useful (we just do direct assignments).  However, we will need
             * this information in future when we want to do complex synchronisation of lists
             * (where we might want to only synchronise changed values).  In these scenarios
             * we will need the type information available to perform better heuristics.
             */

            var names = store.GetNames();
            var isFields = store.GetIsFields();
            for (var i = 0; i < names.Length; i++)
            {
                var name = names[i];
                var isField = isFields[i];
                if (isField)
                {
                    this.PerformFieldAssignment(synchronised, store, authoritative, name);
                }
                else
                {
                    this.PerformPropertyAssignment(synchronised, store, authoritative, name);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Apply synchronisation local to the specified object.
        /// </summary>
        /// <param name="synchronised">
        /// The synchronised object.
        /// </param>
        /// <param name="store">
        /// The synchronisation store for the object.
        /// </param>
        /// <param name="authoritative">
        /// Whether this is an authoritative synchronisation.
        /// </param>
        public void Apply(ISynchronised synchronised, SynchronisationStore store, bool authoritative)
        {
            /*
             * TODO Use type information in synchronisation engine
             *
             * We don't yet use the type information on the synchronisation store
             * for anything useful (we just do direct assignments).  However, we will need
             * this information in future when we want to do complex synchronisation of lists
             * (where we might want to only synchronise changed values).  In these scenarios
             * we will need the type information available to perform better heuristics.
             */

            var names    = store.GetNames();
            var isFields = store.GetIsFields();

            for (var i = 0; i < names.Length; i++)
            {
                var name    = names[i];
                var isField = isFields[i];
                if (isField)
                {
                    this.PerformFieldAssignment(synchronised, store, authoritative, name);
                }
                else
                {
                    this.PerformPropertyAssignment(synchronised, store, authoritative, name);
                }
            }
        }