public NoSqlRepository(NoSQLContext context, Options options, ISerializerFactory serializerFactory, ITypeVersioner versioner) { //set the external context this.Context = context; this.Options = options; SerializerFactory = serializerFactory; TypeVersioner = versioner; }
public static void UpdateLastTweetId(ObjectId _id, decimal _tweetId) { IMongoCollection <LastTweetInfo> collection = new NoSQLContext().lastTweetCollection; collection.ReplaceOne(b => b.TweetId != 0, new LastTweetInfo() { Id = _id, TweetId = _tweetId }); }
public static List <Tweets> GetAllTweets(DateTime fromDate, DateTime toDate, string sentType) { IMongoCollection <Tweets> collection = new NoSQLContext().twitterCollection; return(collection.Find(b => !string.IsNullOrEmpty(b.Text) && ((b.sentiment.SentimentType.Equals(sentType) && !string.IsNullOrEmpty(sentType)) || string.IsNullOrEmpty(sentType)) && ((b.CreatedDate >= fromDate && fromDate != DateTime.MinValue) || fromDate == DateTime.MinValue) && ((b.CreatedDate <= toDate && toDate != DateTime.MinValue) || toDate == DateTime.MinValue) ).SortByDescending(s => s.CreatedDate).ToList <Tweets>()); }
public static void UpdateResponseStatus(decimal _tweetId, string status) { IMongoCollection <Tweets> collection = new NoSQLContext().twitterCollection; Tweets tweet = new Tweets(); tweet = collection.Find(b => b.TweetId == _tweetId).ToList <Tweets>().First(); tweet.ResponseStatus = status; collection = new NoSQLContext().twitterCollection; collection.ReplaceOne(b => b.TweetId == _tweetId, tweet); }
public static LastTweetInfo GetLastTweetId() { IMongoCollection <LastTweetInfo> collection = new NoSQLContext().lastTweetCollection; return(collection.Find(b => b.TweetId != 0).First <LastTweetInfo>()); }
public static void InsertSingleTweet(Tweets tweet) { IMongoCollection <Tweets> collection = new NoSQLContext().twitterCollection; collection.InsertOne(tweet); }
private Store(NoSQLContext context, Options options, ISerializerFactory serializerFactory, ITypeVersioner versioner) : base(context, options, serializerFactory, versioner) { this._context = context; }
private Store(NoSQLContext context) : this(context, new Options(), new DefaultSerializerFactory(), new TypeVersioner()) { }
public NoSqlRepository(NoSQLContext context, Options options, ISerializerFactory serializerFactory, ITypeVersioner versioner) { _store = new NoSqlRepository(context, options, serializerFactory, versioner); }
public NoSqlRepository(NoSQLContext context) : this(context, new Options(), new DefaultSerializerFactory(), new TypeVersioner()) { }
static void Main(string[] args) { try { YoIt f**k = new YoIt(); f**k.Yo(); DbInitializationTools.DbInitializerStrategyFactory("CreateIfChanged"); Console.WriteLine("Clear database?"); var instruction = Console.ReadKey(); if (instruction.Key == ConsoleKey.Y) { using (var context = new NoSQLContext()) { context.Database.ExecuteSqlCommand("Delete from Store"); context.Database.ExecuteSqlCommand("Delete from typeversion"); context.Database.ExecuteSqlCommand("Delete from StoreArchive"); } } //DoIt(); //MigrationsFuck(); //return; // Temp test of the system Guid id1, id2; using (var context = new NoSQLContext()) { NoSqlRepository s = new NoSqlRepository(context); id1 = s.Create(@"P&P test 1"); id2 = s.Create(@"P&P test 2"); context.SaveChanges(); } using (var context = new NoSQLContext()) { NoSqlRepository <string> s = new NoSqlRepository <string>(context); var foo = s.Retrieve(id1); var bar = s.Retrieve(id2); Console.WriteLine(foo); Console.WriteLine(bar); } using (var store = new Store()) { var one = BuildMeOne(); store.Create(one); store.SaveChanges(); } using (var store = new Store()) { var readBack = store.TryRetrieve <SimplePoco>(new Guid("DA722261-062C-43DF-B64C-B17829A58440")); var yo = 3334; } } catch (Exception ex) { Console.Write(ex.ToString()); } Console.ReadKey(); }