public AddressDto Delete(IObjectIdentifier <ulong> id) { var address = _repository.FindById(id); _repository.Delete(address.Id); return(AddressDto.FromDomain(address)); }
public BillingInfoDto Delete(IObjectIdentifier <ulong> id) { var billingInfo = _repository.FindById(id); _repository.Delete(billingInfo.Id); return(BillingInfoDto.FromDomain(billingInfo)); }
public InvoicePaymentDto Delete(IObjectIdentifier <ulong> id) { var payment = _repository.FindById(id); _repository.Delete(payment.Id); return(InvoicePaymentDto.FromDomain(payment)); }
public static MvcHtmlString PropertyFor <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression) { if (ModeProvider == null) { ModeProvider = DependencyResolver.Current.GetService <IModeProvider>(); } var result = html.DisplayFor(expression); if (ModeProvider.GetIsPageEditing(html.ViewContext.HttpContext) != true) { return(result); } if (ObjectIdentifier == null) { ObjectIdentifier = DependencyResolver.Current.GetService <IObjectIdentifier>(); } if (PropertyExpressionMetaDataProvider == null) { PropertyExpressionMetaDataProvider = DependencyResolver.Current.GetService <IPropertyExpressionMetaDataProvider>(); } var metaData = PropertyExpressionMetaDataProvider.GetFor(expression); return(MvcHtmlString.Create($"<span class=\"poetry-page-editing-property\" property-name=\"{metaData.PropertyName}\" object-id=\"{ObjectIdentifier.GetId(metaData.OwnerObject ?? html.ViewData.Model)}\">{result}</span>")); }
public ContactInfoDto Delete(IObjectIdentifier <ulong> id) { var contactInfo = _repository.FindById(id); _repository.Delete(contactInfo.Id); return(ContactInfoDto.FromDomain(contactInfo)); }
public SupplierDomain FindById(IObjectIdentifier <ulong> id) { var command = new SupplierFIndByIdCommand(_dataSource, id.Value); var entity = command.Execute() ?? throw new ResourceNotFoundException(typeof(SupplierEntity), id); return(Aggreagate(entity)); }
public InvoiceDomain FindById(IObjectIdentifier <ulong> id) { var command = new InvoiceFIndByIdCommand(_dataSource, id.Value); var entity = command.Execute() ?? throw new ResourceNotFoundException(typeof(InvoiceEntity), id); return(PrepareAggregate(entity)); }
public EntitySupplierDto Delete(IObjectIdentifier <ulong> id) { var supplier = _repository.FindById(id); _repository.Delete(supplier.Id); return(EntitySupplierDto.FromDomain(supplier)); }
public InvoicePayment FindById(IObjectIdentifier <ulong> id) { var command = new InvoicePaymentFindByIdCommand(_dataSource, id.Value); var entity = command.Execute() ?? throw new ResourceNotFoundException(typeof(InvoicePaymentEntity), id); return(entity.ToDomain()); }
public EntityReceiver( IObjectIdentifier <ulong> id, BillingInfoDomain billingInfo, ContactInfoDomain contactInfo ) : base(id, billingInfo, contactInfo) { }
public ObjectData(IObjectIdentifier objectIdentifier) { ObjectIdentifier = objectIdentifier; ObjectLocator = new ObjectLocator(); ObjectIdentifier.RegisterComponents(ObjectLocator); }
public InvoiceItemDto Delete(IObjectIdentifier <ulong> id) { var item = _repository.FindById(id); _repository.Delete(item.Id); return(InvoiceItemDto.FromDomain(item)); }
private EntitySupplierDto( IObjectIdentifier <ulong> id, BillingInfoDto billingInfo, ContactInfoDto contactInfo ) : base(id, billingInfo, contactInfo) { }
public ContactInfoDomain FindById(IObjectIdentifier <ulong> id) { var command = new ContactInfoFindByIdCommand(_dataSource, id.Value); var entity = command.Execute() ?? throw new ResourceNotFoundException(typeof(ContactInfoEntity), id); return(entity.ToDomain()); }
/// <summary> /// 异步设置对象标识。 /// </summary> /// <param name="identifier">给定的 <see cref="IObjectIdentifier"/>。</param> /// <param name="newIdFactory">给定的新对象标识工厂方法。</param> /// <param name="cancellationToken">给定的 <see cref="CancellationToken"/>(可选)。</param> /// <returns>返回一个包含标识(兼容各种引用与值类型标识)的异步操作。</returns> public static async ValueTask <object> SetObjectIdAsync(this IObjectIdentifier identifier, Func <object, object> newIdFactory, CancellationToken cancellationToken = default) { var currentId = await identifier.GetObjectIdAsync(cancellationToken).DisableAwaitContext(); return(await identifier.SetObjectIdAsync(newIdFactory(currentId), cancellationToken) .DisableAwaitContext()); }
public void Delete(IObjectIdentifier <ulong> id) { var command = new InvoiceItemDeleteCommand(_dataSource, id.Value); if (!command.Execute()) { throw new ResourceNotFoundException(typeof(AddressEntity), id); } }
public void Delete(IObjectIdentifier <ulong> id) { var command = new ContactInfoDeleteCommand(_dataSource, id.Value); if (!command.Execute()) { throw new ResourceNotFoundException(typeof(ContactInfoEntity), id); } }
protected Entity( IObjectIdentifier <ulong> id, BillingInfoDomain billingInfo, ContactInfoDomain contactInfo ) { Id = id; BillingInfo = billingInfo; ContactInfo = contactInfo; }
protected EntityDto( IObjectIdentifier <ulong> id, BillingInfoDto billingInfo, ContactInfoDto contactInfo ) { _id = id; _billingInfo = billingInfo; _contactInfo = contactInfo; }
public static async ValueTask <object> SetObjectIdAsync(this IObjectIdentifier identifier, Func <object, object> newIdFactory, CancellationToken cancellationToken = default) { identifier.NotNull(nameof(identifier)); newIdFactory.NotNull(nameof(newIdFactory)); var newId = await identifier.GetObjectIdAsync(cancellationToken).ConfigureAwait(); return(await identifier.SetObjectIdAsync(newIdFactory.Invoke(newId), cancellationToken) .ConfigureAwait()); }
public SeriesIdentifier(IObjectIdentifier owner, ObjectDescriptor type, IEnumerable <SeriesIdentifier> sources, IEnumerable <ObjectDescriptor> modifiers) { Owner = owner; Type = type; Sources = sources.ToList(); Modifiers = modifiers; ShortDesignator = Owner.ShortDesignator + "." + Type.Name; LongDesignator = BuildLongDesignator(); Guid = LongDesignator.GetHashCode(); }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources, IEnumerable<ObjectDescriptor> modifiers ) { Owner = owner; Type = type; Sources = sources.ToList(); Modifiers = modifiers; ShortDesignator = Owner.ShortDesignator + "." + Type.Name; LongDesignator = BuildLongDesignator(); Guid = LongDesignator.GetHashCode(); }
private BillingInfoDto( IObjectIdentifier<ulong> id, string companyName, string zipCode, AddressDto billingAddress ) { _id = id; _companyName = companyName; _zipCode = zipCode; _billingAddress = billingAddress; }
public void Register(IObjectIdentifier objectIdentifier) { if (objectIdentifier == null) { throw new NullReferenceException($"Parameter {nameof(objectIdentifier)} cannot be null."); } if (_objectsMap.ContainsKey(objectIdentifier.ObjectId)) { throw new Exception("Object already registered."); } _objectsMap.Add(objectIdentifier.ObjectId, new ObjectData(objectIdentifier)); }
public void Remove(IObjectIdentifier objectIdentifier) { if (objectIdentifier == null) { throw new NullReferenceException($"Parameter {nameof(objectIdentifier)} cannot be null."); } if (!_objectsMap.ContainsKey(objectIdentifier.ObjectId)) { throw new Exception("Object was not being registered."); } _objectsMap.Remove(objectIdentifier.ObjectId); }
public InvoicePayment( IObjectIdentifier <ulong> id, EPaymentType paymentPaymentType, DateTime date, TimeZoneInfo timezone, decimal amount ) { Id = id; Type = paymentPaymentType; Date = date; TimeZone = timezone; Amount = amount; }
private InvoicePaymentDto( IObjectIdentifier <ulong> id, EPaymentType type, DateTime date, TimeZoneInfo timeZone, decimal amount ) { _id = id; _type = type; _date = date; _timeZone = timeZone; _amount = amount; }
public InvoiceItem( IObjectIdentifier <ulong> id, string name, decimal unitPrice, EUnitType unitType, decimal discount, double quantity ) { Id = id; Name = name; UnitPrice = unitPrice; UnitType = unitType; Discount = discount; Quantity = quantity; }
private InvoiceItemDto( IObjectIdentifier <ulong> id, string name, decimal unitPrice, EUnitType unitType, decimal discount, double quantity ) { _id = id; _name = name; _unitPrice = unitPrice; _unitType = unitType; _discount = discount; _quantity = quantity; }
private AddressDto( IObjectIdentifier <ulong> id, string country, string city, string street, string state, string buildingNumber, string flatNumber ) { _id = id; _country = country; _city = city; _street = street; _state = state; _buildingNumber = buildingNumber; _flatNumber = flatNumber; }
public Address( IObjectIdentifier <ulong> id, string country, string city, string street, string state, string buildingNumber, string flatNumber ) { Id = id; Country = country; City = city; Street = street; State = state; BuildingNumber = buildingNumber; FlatNumber = flatNumber; }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, params SeriesIdentifier[] sources ) : this(owner, type, sources, new List<ObjectDescriptor>()) { }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources ) : this(owner, type, sources, new List<ObjectDescriptor>()) { }