本文整理汇总了C#中IIdGenerator类的典型用法代码示例。如果您正苦于以下问题:C# IIdGenerator类的具体用法?C# IIdGenerator怎么用?C# IIdGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IIdGenerator类属于命名空间,在下文中一共展示了IIdGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RedirectionController
public RedirectionController(IRepository repository, IIdGenerator idGenerator, IBase58Converter base58Converter, IAdminCodeGenerator adminCodeGenerator)
{
_repository = repository;
_idGenerator = idGenerator;
_base58Converter = base58Converter;
_adminCodeGenerator = adminCodeGenerator;
}
开发者ID:mschuler,项目名称:307.ch,代码行数:7,代码来源:RedirectionController.cs
示例2: RepoTimelineProvider
public RepoTimelineProvider(IIdGenerator generator, ITransactionManager trans, IRepository<TimelineItem> repoTi, IRepository<TimelineItemHistory> repoTih)
{
this.generator = generator;
this.trans = trans;
this.repoTi = repoTi;
this.repoTih = repoTih;
}
开发者ID:cairabbit,项目名称:daf,代码行数:7,代码来源:RepoTimelineProvider.cs
示例3: GetDocumentId
/// <summary>
/// GetDocumentId is an invalid operation for wrapper classes.
/// </summary>
/// <param name="id">Not applicable.</param>
/// <param name="idGenerator">Not applicable.</param>
/// <returns>Not applicable.</returns>
public bool GetDocumentId(
out object id,
out IIdGenerator idGenerator
) {
var message = string.Format("GetDocumentId method cannot be called on a {0}", this.GetType().Name);
throw new InvalidOperationException(message);
}
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:13,代码来源:BaseWrapper.cs
示例4: InvalidOperationException
bool IBsonSerializable.GetDocumentId(
out object id,
out IIdGenerator idGenerator
)
{
throw new InvalidOperationException();
}
开发者ID:jenrom,项目名称:mongo-csharp-driver,代码行数:7,代码来源:BuilderBase.cs
示例5: StatsModule
public StatsModule(ITemplate tmpl, IIdGenerator idgen, SavegameStorage storage)
{
Post["/games"] = _ =>
{
// Get the temporary location of the file on the server
var file = Request.Headers["X-FILE"].FirstOrDefault();
// Get the extension of the file when it was uploaded as the
// temporary file doesn't have an extension
var extension = Request.Headers["X-FILE-EXTENSION"].FirstOrDefault();
if (file == null)
throw new ArgumentException("File can't be null");
if (extension == null)
throw new ArgumentException("File extension can't be null");
Save savegame;
using (var stream = getStream(file, extension))
using (parsingTimer.NewContext())
savegame = new Save(stream);
// Turn the savegame into html and return the url for it
var stats = statsTimer.Time(() => Aggregate(savegame));
string contents = templateTimer.Time(() => tmpl.Render(stats));
string id = idgen.NextId();
return storage.Store(contents, id);
};
}
开发者ID:nickbabcock,项目名称:EU4.Savegame,代码行数:27,代码来源:StatsModule.cs
示例6: SetupModule
public SetupModule(IAggregateRootRepository repository,
IAccountRepository accountRepository,
IIdGenerator idGenerator)
:base("/setup")
{
Get["/"] = _ =>
{
if (accountRepository.Count() > 0)
return HttpStatusCode.NotFound;
return View["Index"];
};
Post["/"] = _ =>
{
var model = this.Bind<CreateModel>();
if (accountRepository.Count() > 0)
return HttpStatusCode.NotFound;
var account = new Domain.Account(idGenerator.NextGuid(),
model.Name, model.FirstName, model.LastName, model.Email);
account.ChangePassword(model.Password);
account.MakeAdmin();
repository.Save(account);
return Response.AsRedirect("/");
};
}
开发者ID:kcornelis,项目名称:FreelanceManager.NET,代码行数:31,代码来源:SetupModule.cs
示例7: GetDocumentId
public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
{
id = null;
idGenerator = null;
idNominalType = null;
return false;
}
开发者ID:jarlef,项目名称:Bifrost,代码行数:7,代码来源:ConceptSerializer.cs
示例8: CreatePropertiesFactory
private Func<RogerEndpoint, IBasicProperties> CreatePropertiesFactory(IModel model,
IIdGenerator idGenerator,
IMessageTypeResolver messageTypeResolver,
IMessageSerializer serializer,
ISequenceGenerator sequenceGenerator)
{
var properties = model.CreateBasicProperties();
properties.MessageId = idGenerator.Next();
properties.Type = messageTypeResolver.Unresolve(messageType);
properties.ContentType = serializer.ContentType;
properties.Headers = new Hashtable
{
{Headers.Sequence, BitConverter.GetBytes(sequenceGenerator.Next(messageType))}
};
if (persistent)
properties.DeliveryMode = 2;
FillAdditionalProperties(properties, idGenerator);
return endpoint =>
{
properties.ReplyTo = endpoint;
return properties;
};
}
开发者ID:bibendus,项目名称:Roger,代码行数:28,代码来源:AbstractDeliveryFactory.cs
示例9: GetDocumentId
/// <summary>
/// Gets the document Id.
/// </summary>
/// <param name="document">The document.</param>
/// <param name="id">The Id.</param>
/// <param name="idGenerator">The IdGenerator for the Id type.</param>
/// <returns>True if the document has an Id.</returns>
public virtual bool GetDocumentId(
object document,
out object id,
out IIdGenerator idGenerator
) {
throw new InvalidOperationException("Subclass must implement GetDocumentId");
}
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:14,代码来源:BsonBaseSerializer.cs
示例10: GetDocumentId
public bool GetDocumentId(out object id, out Type idNominalType, out IIdGenerator idGenerator)
{
id = this.Name;
idNominalType = typeof(string);
idGenerator = null;
return true;
}
开发者ID:Jiangew,项目名称:quartz.net-mongodb,代码行数:8,代码来源:CalendarWrapper.cs
示例11: MyListWishController
public MyListWishController(DTOMapper dtoMapper, IUserIdProvider userIdProvider,
IRepository<WishList> repository, IIdGenerator<Wish> idGenerator )
{
_dtoMapper = dtoMapper;
_userIdProvider = userIdProvider;
_repository = repository;
_idGenerator = idGenerator;
}
开发者ID:wooboo,项目名称:WishlistApi,代码行数:8,代码来源:MyListWishController.cs
示例12: Create
public IDelivery Create(IModel model,
IIdGenerator idGenerator,
IMessageTypeResolver messageTypeResolver,
IMessageSerializer serializer,
ISequenceGenerator sequenceGenerator)
{
return inner;
}
开发者ID:simoneb,项目名称:Roger,代码行数:8,代码来源:UnconfirmedDeliveryFactory.cs
示例13: GetDocumentId
/// <summary>
/// Gets the document Id.
/// </summary>
/// <param name="document">The document.</param>
/// <param name="id">The Id.</param>
/// <param name="idNominalType">The nominal type of the Id.</param>
/// <param name="idGenerator">The IdGenerator for the Id type.</param>
/// <returns>True if the document has an Id.</returns>
public virtual bool GetDocumentId(
object document,
out object id,
out Type idNominalType,
out IIdGenerator idGenerator)
{
throw new NotSupportedException("Subclass must implement GetDocumentId.");
}
开发者ID:masukuma,项目名称:Nimbus,代码行数:16,代码来源:BsonBaseSerializer.cs
示例14: AdminModule
public AdminModule(IAggregateRootRepository repository,
IIdGenerator idGenerator)
: base("/write/admin")
{
this.RequiresAuthentication();
this.RequiresClaims(new[] { "Admin" });
Post["/account/create"] = parameters =>
{
var model = this.Bind<EditableAccount>();
var account = new Domain.Account(idGenerator.NextGuid(),
model.Name, model.FirstName, model.LastName, model.Email);
var password = account.GeneratePassword();
repository.Save(account);
return Json(new
{
Account = new Account(account),
Password = password
});
};
Post["/account/update/{id:guid}"] = parameters =>
{
var model = this.Bind<EditableAccount>();
var account = repository.GetById<Domain.Account>((Guid)parameters.id);
if (account != null)
{
account.ChangeDetails(model.Name, model.FirstName, model.LastName, model.Email);
repository.Save(account);
return Json(new
{
Account = new Account(account)
});
}
return null;
};
Post["/account/{id:guid}/newpassword"] = parameters =>
{
var model = this.Bind<AccountNewPassword>();
var account = repository.GetById<Domain.Account>((Guid)parameters.id);
if (account != null)
{
account.ChangePassword(model.Password);
repository.Save(account);
}
return null;
};
}
开发者ID:kcornelis,项目名称:FreelanceManager.NET,代码行数:58,代码来源:AdminModule.cs
示例15: Yard
/// <summary>
/// Constructor
/// </summary>
/// <param name="idGenerator">A generator to create ids to sorting lines</param>
/// <param name="configuration">A configuration object</param>
/// <param name="lines">The character representation of all sorting lines</param>
public Yard(IIdGenerator idGenerator, IConfiguration configuration, IEnumerable<IEnumerable<char>> lines)
{
IdGenerator = idGenerator;
Configuration = configuration;
SortingLines = CreateSortingLines(lines);
YardLocomotive = new YardLocomotive(Configuration);
Yardmaster = new Yardmaster(YardLocomotive);
TrainLine = new TrainLine();
}
开发者ID:hperantunes,项目名称:cn-railway,代码行数:15,代码来源:Yard.cs
示例16: GetDocumentId
/// <summary>
/// Gets the document Id.
/// </summary>
/// <param name="document">The document.</param>
/// <param name="id">The Id.</param>
/// <param name="idNominalType">The nominal type of the Id.</param>
/// <param name="idGenerator">The IdGenerator for the Id type.</param>
/// <returns>True if the document has an Id.</returns>
public bool GetDocumentId(
object document,
out object id,
out Type idNominalType,
out IIdGenerator idGenerator)
{
var bsonDocument = (BsonDocument)document;
return ((IBsonSerializable)bsonDocument).GetDocumentId(out id, out idNominalType, out idGenerator);
}
开发者ID:andreabalducci,项目名称:mongo-csharp-driver,代码行数:17,代码来源:BsonDocumentSerializer.cs
示例17: Cache
public Cache(IIdGenerator idGenerator, IObjectGraph objectGraph, IEnumerable<IMaterializationHook> materializationHooks)
{
if (idGenerator == null) throw new ArgumentNullException("idGenerator");
if (objectGraph == null) throw new ArgumentNullException("objectGraph");
if (materializationHooks == null) throw new ArgumentNullException("materializationHooks");
_idGenerator = idGenerator;
_objectGraph = objectGraph;
_materializationHooks = materializationHooks;
}
开发者ID:Tatooine,项目名称:FakeDb,代码行数:10,代码来源:Cache.cs
示例18: IdMap
/// <summary>
/// Initializes a new instance of the <see cref="IdMap"/> class.
/// </summary>
/// <param name="memberName">Name of the member.</param>
/// <param name="memberGetter">The member getter.</param>
/// <param name="memberSetter">The member setter.</param>
/// <param name="valueType">Type of the value.</param>
/// <param name="idGenerator">The id generator.</param>
public IdMap(string memberName, Func<object, object> memberGetter, Action<object, object> memberSetter, IIdGenerator idGenerator, IValueConverter valueConverter, object unsavedValue)
: base("_id", memberName, memberGetter, memberSetter, true)
{
if (idGenerator == null)
throw new ArgumentNullException("idGenerator");
this.IdGenerator = idGenerator;
this.UnsavedValue = unsavedValue;
this.ValueConverter = valueConverter;
}
开发者ID:andoco,项目名称:mongodb-csharp,代码行数:18,代码来源:IdMap.cs
示例19: CreateContext
public void CreateContext()
{
_typeMapper = new Moq.Mock<ITypeMapper>().Object;
_random = new Moq.Mock<IRandom>().Object;
_idGenerator = new Moq.Mock<IIdGenerator>().Object;
var context = Create();
Assert.That(context.TypeMapper, Is.Not.Null);
Assert.That(context.Random, Is.Not.Null);
Assert.That(context.IdGenerator, Is.Not.Null);
}
开发者ID:andy-uq,项目名称:Echo,代码行数:12,代码来源:ContextTests.cs
示例20: ContentProvider
public ContentProvider(IIdGenerator idGenerator, ITransactionManager trans,
IRepository<Category> repoCategory,
IRepository<Content> repoContent,
IRepository<CategoryContent> repoContentCategory,
IRepository<ContentRelation> repoContentRelation)
{
this.idGenerator = idGenerator;
this.trans = trans;
this.repoCategory = repoCategory;
this.repoContent = repoContent;
this.repoContentCategory = repoContentCategory;
this.repoContentRelation = repoContentRelation;
}
开发者ID:cairabbit,项目名称:daf,代码行数:13,代码来源:ContentProvider.cs
注:本文中的IIdGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论