Пример #1
0
        /// <summary>
        /// Ensure that moniker resolvers and domain element serializers are installed properly on the given store,
        /// so that deserialization can be carried out correctly.
        /// </summary>
        /// <param name="store">Store on which moniker resolvers will be set up.</param>
        internal protected virtual void InitializeSerialization(DslModeling::Store store)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(store != null);
            if (store == null)
            {
                throw new global::System.ArgumentNullException("store");
            }
            #endregion

            DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(store);

            // Register the moniker resolver for this model, unless one is already registered
            DslModeling::IMonikerResolver monikerResolver = store.FindMonikerResolver(LibraryDomainModel.DomainModelId);
            if (monikerResolver == null)
            {
                monikerResolver = new LibrarySerializationBehaviorMonikerResolver(store, directory);
                store.AddMonikerResolver(LibraryDomainModel.DomainModelId, monikerResolver);
            }

            // Add serialization behaviors
            directory.AddBehavior(LibrarySerializationBehavior.Instance);
        }