public override SqlCeTestStore CreateTestStore() { return(SqlCeTestStore.GetOrCreateShared(DatabaseName, () => { using (var context = new FindContext(_options)) { context.Database.EnsureClean(); Seed(context); } })); }
public override InMemoryTestStore CreateTestStore() { return InMemoryTestStore.CreateScratch(() => { using (var context = new FindContext(_options)) { Seed(context); } }, _serviceProvider); }
public override InMemoryTestStore CreateTestStore() => InMemoryTestStore.CreateScratch( _serviceProvider, nameof(FindInMemoryFixture), () => { using (var context = new FindContext(_options)) { Seed(context); } });
public override SqlServerTestStore CreateTestStore() { return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { using (var context = new FindContext(_options)) { context.Database.EnsureCreated(); Seed(context); TestSqlLoggerFactory.Reset(); } })); }
/// <summary> /// 数据库操作类 /// </summary> /// <param name="ConnectionString">链接串 不传入默认为 ConnectionString </param> public DBContext(string ConnectionString = null) { if (string.IsNullOrEmpty(ConnectionString)) { _ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); } else { _ConnectionString = ConnectionString; } add = new AddContext(_ConnectionString); edit = new EditContext(_ConnectionString); delete = new DeleteContext(_ConnectionString); find = new FindContext(_ConnectionString); dbhelper = new DbHelper(_ConnectionString); check = new CheckContext <BaseEntity>(_ConnectionString); jss = new JavaScriptSerializer(); }
private FindContext FindInternal(ActorReference reference, int hashCode) { var context = new FindContext { Bucket = hashCode % _buckets.Length, LastIndex = -1, Index = _buckets[hashCode % _buckets.Length] - 1 }; while (context.Index >= 0) { var slot = _slots[context.Index]; if (slot.HashCode == hashCode && _comparer.Equals(slot.Value.Reference, reference)) { context.Found = true; break; } context.LastIndex = context.Index; context.Index = _slots[context.Index].Next; } return(context); }