コード例 #1
0
        static void Main(string[] args)
        {
            MongoDBRepository.RegisterMongoDBContext(new TripperCenterDBContext());
            MongoDBRepository.RegisterMongoDBContext(new DeliveryCenterDBContext());
            MongoDBRepository.RegisterMongoDBContext(new StatusCenterDBContext());
            MongoDBRepository.RegisterMongoDBContext(new RelationCenterDBContext());
            MongoDBRepository.RegisterMongoIndex();

            var      ass  = WinAssemblyUtility.GetAssembly();
            HostInfo host = new HostInfo(ConfigurationManager.AppSettings["WcfHostAddress"]).LoadTypesFromAssemblies(ass);

            using (ServiceContainer container = new ServiceContainer())
            {
                container.Open(host);
                Console.WriteLine("press close to stop host");

                while (true)
                {
                    if ("close" == Console.ReadLine().ToLower())
                    {
                        container.Close(host);
                        break;
                    }
                }
                Console.WriteLine("press 'Enter' to quit");
                Console.ReadKey();
            }
        }
コード例 #2
0
 public void RegisterMongoDBContext()
 {
     foreach (Type type in WinAssemblyUtility.GetAssembly <IMongoDBContext>().FindTypes <IMongoDBContext>())
     {
         if (type.IsAbstract)
         {
             continue;
         }
         var context = Activator.CreateInstance(type) as MongoDBContext;
         MongoDBRepository.RegisterMongoDBContext(context);
     }
 }