public MongoCollection(Mongo client, string colName)
        {
            this.client = client;
            collection  = client.Database.GetCollection <T>(colName);

            List <PropertyInfo> props = typeof(T).GetProperties().Where(x => MongoIndexAttribute.GetIndexType(x) != IndexType.None).ToList();

            foreach (PropertyInfo i in props)
            {
                IndexType t = MongoIndexAttribute.GetIndexType(i);


                ///collection.Indexes.CreateOne(new IndexKeysDefinitionBuilder<T>().Ascending()
            }
        }
Esempio n. 2
0
 //
 public static bool DeleteObject(string id)
 {
     Mongo.DeleteObject(x => x.ObjectID == id);
     return(true);
 }
Esempio n. 3
0
 protected static List <T> GetObjects(Expression <Func <T, bool> > condition)
 {
     return(Mongo.RetrieveObjects(condition));
 }
Esempio n. 4
0
 //Multiple
 public static List <T> GetObjects()
 {
     return(Mongo.RetrieveObjects());
 }
Esempio n. 5
0
 //Single
 public static T GetObject(string id)
 {
     return(Mongo.RetrieveObject(x => x.ObjectID == id));
 }
Esempio n. 6
0
 public bool Update()
 {
     Mongo.ReplaceObject(x => x.ObjectID == ObjectID, (T)this);
     return(true);
 }
Esempio n. 7
0
 //Manipulation
 public bool Insert()
 {
     Mongo.InsertObject((T)this);
     return(true);
 }
 public MongoProvider(MongoSettings settings)
 {
     Settings = settings;
     mongo    = new MongoDB.Mongo(settings);
 }