本文整理汇总了C#中IIdGenerator类的典型用法代码示例。如果您正苦于以下问题:C# IIdGenerator类的具体用法?C# IIdGenerator怎么用?C# IIdGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IIdGenerator类属于命名空间,在下文中一共展示了IIdGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RedirectionController
public RedirectionController(IRepository repository, IIdGenerator idGenerator, IBase58Converter base58Converter, IAdminCodeGenerator adminCodeGenerator)
{
_repository = repository;
_idGenerator = idGenerator;
_base58Converter = base58Converter;
_adminCodeGenerator = adminCodeGenerator;
}
示例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;
}
示例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);
}
示例4: InvalidOperationException
bool IBsonSerializable.GetDocumentId(
out object id,
out IIdGenerator idGenerator
)
{
throw new InvalidOperationException();
}
示例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);
};
}
示例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("/");
};
}
示例7: GetDocumentId
public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
{
id = null;
idGenerator = null;
idNominalType = null;
return false;
}
示例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;
};
}
示例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");
}
示例10: GetDocumentId
public bool GetDocumentId(out object id, out Type idNominalType, out IIdGenerator idGenerator)
{
id = this.Name;
idNominalType = typeof(string);
idGenerator = null;
return true;
}
示例11: MyListWishController
public MyListWishController(DTOMapper dtoMapper, IUserIdProvider userIdProvider,
IRepository<WishList> repository, IIdGenerator<Wish> idGenerator )
{
_dtoMapper = dtoMapper;
_userIdProvider = userIdProvider;
_repository = repository;
_idGenerator = idGenerator;
}
示例12: Create
public IDelivery Create(IModel model,
IIdGenerator idGenerator,
IMessageTypeResolver messageTypeResolver,
IMessageSerializer serializer,
ISequenceGenerator sequenceGenerator)
{
return inner;
}
示例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.");
}
示例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;
};
}
示例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();
}