Exemple #1
0
        static BaseService()
        {
            var isSupport = CommonConfig.IsSupportMongoDb;

            if (isSupport)
            {
                MongoInitHelper.InitMongoDBRepository();
            }
        }
Exemple #2
0
        public BaseMongoTest()
        {
            MongoInitHelper.InitMongoDBRepository();

            //如果手动指定关系,则需要同时指定自定义的特殊序列化机制,否则会采用默认的序列化机制
            var dateTimeSerializer         = new DateTimeSerializer(DateTimeKind.Local);
            var nullableDateTimeSerializer = new NullableSerializer <DateTime>(dateTimeSerializer);

            BsonClassMap.RegisterClassMap <MyTestEntity>(rc =>
            {
                rc.MapProperty(i => i.A);
                rc.MapProperty(i => i.B).SetSerializer(dateTimeSerializer);
                rc.MapProperty(i => i.C);
                rc.MapProperty(i => i.D).SetSerializer(nullableDateTimeSerializer);
            });
        }
Exemple #3
0
 static BaseViewModelGenerator()
 {
     MongoInitHelper.InitMongoDBRepository();
 }
 static BaseMongoService()
 {
     MongoInitHelper.InitMongoDBRepository();
 }
 public BaseMongoTest()
 {
     MongoInitHelper.InitMongoDBRepository();
 }