private static IJsonFormatter <TKey, TSymbol> GetKeyFormatter() { if (typeof(TKey).IsEnum) { return((IJsonFormatter <TKey, TSymbol>)ResolverBase.GetDefaultOrCreate( typeof(EnumStringFormatter <, ,>).MakeGenericType(typeof(TKey), typeof(TSymbol), typeof(TResolver)))); } return(StandardResolvers.GetResolver <TSymbol, TResolver>().GetFormatter <TKey>()); }
public void TestMethod1() { UnitOfWork.RegisterResolver(ResolverBase.GetResolver <IocFactory>()); using (var workFactory = UnitOfWork.Current) { using (var rep = workFactory.CreateRepository <DocumentRepositorySample>()) { var entity = rep.Insert(new DocumentRepositorySample() { Name = "123456" }); Assert.IsNotNull(entity.Id); Assert.AreNotEqual(ObjectId.Empty, entity.Id); entity.CreateName = "4321"; entity = rep.GetByKey(entity.Id); Assert.AreEqual("123456", entity.Name); } } }