Ejemplo n.º 1
0
        /// <summary>
        ///     Creates a new instance of the <see cref="DataMap"/>
        ///     class using the specified local state and with all
        ///     fields empty.
        /// </summary>
        /// <param name="applicationSchemaDefinition">The application metadata owning the data map.</param>
        /// <param name="localState">The data map local state.</param>
        public DataMap(ApplicationSchemaDefinition applicationSchemaDefinition, LocalState localState)
        {
            if (applicationSchemaDefinition == null)
            {
                throw new ArgumentNullException("applicationSchemaDefinition");
            }
            if (localState == null)
            {
                throw new ArgumentNullException("localState");
            }

            _application = applicationSchemaDefinition.Name;
            _localState  = localState;

            _fields = applicationSchemaDefinition
                      .Fields
                      .ToDictionary(f => f.Attribute, f => "");

            _customFields = new Dictionary <string, string>();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates a new instance of the <see cref="DataMap"/>
        ///     class using the specified parameters.
        /// </summary>
        /// <param name="application">The name of the application owning the data map.</param>
        /// <param name="fields">The initial data map fields.</param>
        /// <param name="customFields">The initial data map custom fields.</param>
        /// <param name="localState">The data map local state.</param>
        public DataMap(string application, IDictionary <string, string> fields, IDictionary <string, string> customFields, LocalState localState)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (customFields == null)
            {
                throw new ArgumentNullException("customFields");
            }
            if (localState == null)
            {
                throw new ArgumentNullException("localState");
            }

            _application  = application;
            _fields       = fields;
            _customFields = customFields;
            _localState   = localState;
        }