Example #1
0
 internal VariableSchema(int changeSetId, int id, Type dataType, ReadOnlyDimensionList dimensions, string[] cs, MetadataDictionary metadata)
 {
     if (dimensions == null)
     {
         throw new ArgumentNullException("dimensions");
     }
     if (metadata == null)
     {
         throw new ArgumentNullException("metadata");
     }
     this.changeSetId = changeSetId;
     this.id          = id;
     this.dimensions  = dimensions;
     this.cs          = cs;
     this.metadata    = metadata;
     this.dataType    = dataType;
 }
        internal MetadataDictionary FilterChanges(MetadataDictionary metadata)
        {
            MetadataDictionary md = new MetadataDictionary();

            if (metadata.Count == 0 && !metadata.HasChanges)
            {
                return(md);
            }

            Dictionary <string, object> dict = metadata.AsDictionary(SchemaVersion.Recent);

            foreach (var item in dict)
            {
                if (!IsHiddenEntry(item.Key))
                {
                    md[item.Key] = item.Value;
                }
            }
            return(md);
        }
        /// <summary>
        /// Applies given collection of changes (both committed and modified parts of its).
        /// </summary>
        /// <param name="proposedChanges"></param>
        internal void ApplyChanges(MetadataDictionary proposedChanges)
        {
            bool localChanges = proposedChanges.dictionary == modified;
            bool dictCreated  = false;

            if (HasChanges)
            {
                dictCreated = true;
                dictionary  = new Dictionary <string, object>(dictionary);
                CopyToDict1(dictionary, modified);
                modified = null;
            }

            if (!localChanges)
            {
                if (!dictCreated)
                {
                    dictionary = new Dictionary <string, object>(dictionary);
                }
                CopyToDict1(dictionary, proposedChanges.dictionary);
                CopyToDict1(dictionary, proposedChanges.modified);
            }
        }
Example #4
0
 /// <summary>
 /// Initializes a DataAccessVariable.
 /// </summary>
 /// <param name="dataSet">The owner of the variable.</param>
 /// <param name="name">Name of the variable.</param>
 /// <param name="dims">Dimensions of the variable.</param>
 /// <param name="assignID">Assign ID automatically or not.</param>
 /// <remarks>
 /// Method creates metadata collection and initializes the Name.
 /// </remarks>
 protected DataAccessVariable(DataSet dataSet, string name, string[] dims, bool assignID) :
     base(dataSet, dims, assignID)
 {
     this.metadata = new MetadataDictionary();
     this.Name     = name;
 }