Exemplo n.º 1
0
        /// <summary>
        /// Called when a provider is first created.  Must register all associated namespaces with the federation.
        /// Can also be used to create initial content in the namespaces.
        /// </summary>
        /// <param name="aFed"></param>
        public IList CreateNamespaces(Federation aFed)
        {
            ArrayList answer = new ArrayList();

            if (SqlNamespaceProvider.Exists(Namespace, ConnectionString))
            {
                throw new Exception("Namespace with the specified name already exists.");
            }

            this.CreateNamespace(Namespace, ConnectionString);

            SqlStore store = new SqlStore();

            throw new NotImplementedException();
            /*
            NamespaceManager manager = aFed.RegisterNamespace(store);
            manager.WriteTopic(manager.DefinitionTopicName.LocalName, "");
            manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Contact", Contact, false);
            manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Title", Title, false);
            string defaultImportedNamespaces = System.Configuration.ConfigurationSettings.AppSettings["DefaultImportedNamespaces"];
            if (defaultImportedNamespaces != null)
            {
                manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Import", defaultImportedNamespaces, false);
            }

            // whoever is last should write a new version
            manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Description", NamespaceDescription, true);
            answer.Add(Namespace);
            return ArrayList.ReadOnly(answer);

            */
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            MockWikiApplication application = new MockWikiApplication(new FederationConfiguration(),
                new LinkMaker("test://SqlStoreTests/"), OutputFormat.HTML,
                new MockTimeProvider(TimeSpan.FromSeconds(1)));
            _federation = new Federation(application);
            _database = new MockDatabase(TestDataSets.Default());

            _federation.RegisterNamespace(new SqlStore(_database), "NamespaceOne",
                new NamespaceProviderParameterCollection(
                    new NamespaceProviderParameter("ConnectionString", _connectionString)));

            // Necessary to bypass security because a non-existent manager can't be
            // retrieved directly from the federation
            NamespaceManager manager = WikiTestUtilities.GetNamespaceManagerBypassingSecurity(_federation, "NamespaceOne");

            _provider = (SqlStore)manager.GetProvider(typeof(SqlStore));
        }
Exemplo n.º 3
0
		/// <summary>
		/// Called when a provider should instantiate and register all of its namespaces in a federation.  
		/// Note that when a provider is first created (e.g., via the admin UI) that this function is not 
		/// called.
		/// </summary>
		/// <param name="aFed"></param>
		public void LoadNamespaces(Federation aFed)
		{
			SqlStore store = new SqlStore(aFed, Namespace, ConnectionString);
			aFed.RegisterNamespace(store);
		}