예제 #1
0
        public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
        {
            m_log.Info("[DATASTORE]: Attempting to load " + dllName);
            Assembly pluginAssembly = Assembly.LoadFrom(dllName);

            foreach (Type pluginType in pluginAssembly.GetTypes())
            {
                if (pluginType.IsPublic)
                {
                    Type typeInterface = pluginType.GetInterface("IRegionDataStore", true);

                    if (typeInterface != null)
                    {
                        IRegionDataStore plug =
                            (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
                        plug.Initialise(connectionstring);

                        m_dataStore = plug;

                        m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
                    }

                    typeInterface = pluginType.GetInterface("IEstateDataStore", true);

                    if (typeInterface != null)
                    {
                        IEstateDataStore estPlug =
                            (IEstateDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
                        estPlug.Initialise(estateconnectionstring);

                        m_estateDataStore = estPlug;
                    }
                }
            }

            //TODO: Add checking and warning to make sure it initialised.
        }
 protected override void InitService(object service)
 {
     ClearDB();
     db = (IEstateDataStore)service;
     db.Initialise(m_connStr);
 }