/// <summary> /// Maps the given <paramref name="relativePath"/> making it rooted on <see cref="CurrentAssemblyDirectory"/>. <paramref name="relativePath"/> must start with <code>~/</code> /// </summary> /// <param name="relativePath">The relative path.</param> /// <returns></returns> public static string MapPathForTest(string relativePath) { Mandate.ParameterCondition(relativePath.StartsWith("~/"), "relativePath"); return(relativePath.Replace("~/", CurrentAssemblyDirectory + "/")); }
/// <summary> /// Initializes a new instance of the <see cref="ShipmentRepository"/> class. /// </summary> /// <param name="work"> /// The work. /// </param> /// <param name="cache"> /// The cache. /// </param> /// <param name="orderLineItemRepository"> /// The order Line Item Repository. /// </param> public ShipmentRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, IOrderLineItemRepository orderLineItemRepository) : base(work, cache) { Mandate.ParameterNotNull(orderLineItemRepository, "orderLineItemRepository"); _orderLineItemRepository = orderLineItemRepository; }
/// <summary> /// Return the Url for a Web Api service /// </summary> /// <param name="url"></param> /// <param name="actionName"></param> /// <param name="controllerName"></param> /// <param name="area"></param> /// <returns></returns> public static string GetUmbracoApiService(this UrlHelper url, string actionName, string controllerName, string area) { Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName"); Mandate.ParameterNotNullOrEmpty(actionName, "actionName"); return(url.Action(actionName, controllerName, new { httproute = "", area = area })); }
public WarehouseCatalog(Guid warehouseKey) { Mandate.ParameterCondition(warehouseKey != Guid.Empty, "warehouseKey"); _warehouseKey = warehouseKey; }
/// <summary> /// Initializes a new instance of the <see cref="CachedQueryProvider"/> class. /// </summary> /// <param name="serviceContext"> /// The <see cref="IServiceContext"/> /// </param> /// <param name="enableDataModifiers"> /// A value indicating whether or not to enable any data modifiers. /// </param> public CachedQueryProvider(IServiceContext serviceContext, bool enableDataModifiers) { Mandate.ParameterNotNull(serviceContext, "ServiceContext is not initialized"); _enableDataModifiers = enableDataModifiers; InitializeProvider(serviceContext); }
/// <summary> /// Initializes a new instance of the <see cref="PatternReplaceFormatter"/> class. /// </summary> /// <param name="patterns"> /// The patterns. /// </param> public PatternReplaceFormatter(IDictionary <string, IReplaceablePattern> patterns) { Mandate.ParameterNotNull(patterns, "patterns"); _patterns = patterns; }
/// <summary> /// Gets the ancestors of the current Content entity relationships /// </summary> /// <param name="collection"></param> /// <returns></returns> public static IEnumerable <File> AncestorsAsFile(this EntityRelationCollection collection) { Mandate.ParameterNotNull(collection, "collection"); return(collection.Ancestors <File>(FixedRelationTypes.FileRelationType)); }
/// <summary> /// Initializes a new instance of the <see cref="ProductVariantDataModifierTaskBase"/> class. /// </summary> /// <param name="merchelloContext"> /// The merchello context. /// </param> protected ProductVariantDataModifierTaskBase(IMerchelloContext merchelloContext) { Mandate.ParameterNotNull(merchelloContext, "merchelloContext"); this._merchelloContext = merchelloContext; }
/// <summary> /// Initializes a new instance of the <see cref="InvoiceCreationAttemptChainTaskBase"/> class. /// </summary> /// <param name="salePreparation"> /// The sale preparation. /// </param> protected InvoiceCreationAttemptChainTaskBase(SalePreparationBase salePreparation) { Mandate.ParameterNotNull(salePreparation, "salePreparation"); this._salePreparation = salePreparation; }
/// <summary> /// Determines whether this group matches the specified route URI. /// </summary> /// <param name="uri">The URI.</param> /// <returns><c>true</c> if this group is a match for the given URI; otherwise, <c>false</c>.</returns> /// <remarks></remarks> public ProviderUriMatchResult IsMatchForUri(Uri uri) { Mandate.ParameterNotNull(uri, "uri"); return(IsMatchForUri(FixUriBugs(uri.ToString()))); }
/// <summary> /// Constructor accepting an IDatabaseFactory instance /// </summary> /// <param name="dbFactory"></param> internal PetaPocoUnitOfWorkProvider(IDatabaseFactory dbFactory) { Mandate.ParameterNotNull(dbFactory, "dbFactory"); _dbFactory = dbFactory; }
/// <summary> /// Initializes a new instance of the <see cref="OfferComponentBase"/> class. /// </summary> /// <param name="definition"> /// The <see cref="OfferComponentDefinition"/>. /// </param> protected OfferComponentBase(OfferComponentDefinition definition) { Mandate.ParameterNotNull(definition, "definition"); this._definition = definition; }
public CustomDateTimeConvertor(string dateTimeFormat) { Mandate.ParameterNotNullOrEmpty(dateTimeFormat, "dateTimeFormat"); _dateTimeFormat = dateTimeFormat; }
/// <summary> /// Initializes a new instance of the <see cref="PayPalApiControllerBase"/> class. /// </summary> /// <param name="merchelloContext"> /// The <see cref="IMerchelloContext"/>. /// </param> protected PayPalApiControllerBase(IMerchelloContext merchelloContext) { Mandate.ParameterNotNull(merchelloContext, "merchelloContext"); _merchelloContext = merchelloContext; }
/// <summary> /// Performs the delete. /// </summary> /// <param name="id">The id.</param> /// <param name="transaction"></param> public void PerformDelete(HiveId id, ExamineTransaction transaction) { Mandate.ParameterNotEmpty(id, "id"); PerformDelete(id.Value.ToString(), transaction); }
/// <summary> /// Initializes a new instance of the <see cref="BraintreeApiRequestFactory"/> class. /// </summary> /// <param name="settings"> /// The settings. /// </param> public BraintreeApiRequestFactory(BraintreeProviderSettings settings) { Mandate.ParameterNotNull(settings, "settings"); _settings = settings; }
/// <summary> /// Performs the delete. /// </summary> /// <param name="id">The id.</param> /// <param name="transaction"></param> /// <remarks> /// This will lookup all all related entities and remove them from the index /// </remarks> public void PerformDelete(string id, ExamineTransaction transaction) { Mandate.ParameterNotNullOrEmpty(id, "id"); //NOTE: The below deletion process relies on having unique GUID ids across the board, // if you want to support int Ids, then we'll need to lookup the item type first // and delete different things based on that, i chose not to do that because // if for some reason the item with the Id that we're deleting isn't there then // any related instances will never be deleted whereas doing the below will delete all // related entities regardless. Action <IEnumerable <SearchResult> > addItemsToDeleteQueue = x => { foreach (var r in x) { var r1 = r; transaction.EnqueueIndexOperation(new LinearHiveIndexOperation { OperationType = IndexOperationType.Delete, Id = new Lazy <string>(() => r1.Id) }); } }; //First, check if there's relations for this id and remove any relations found var relations = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Should() .Id(id, FixedRelationIndexFields.SourceId) .Should() .Id(id, FixedRelationIndexFields.DestinationId).Compile()); addItemsToDeleteQueue(relations); //next, check if there's any items (TypedEntity, AttributeDefinition, AttributeGroup) assigned to a schema by this id, // this will also delete all revisions of TypedEntity too var entities = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Should() .Id(id, FixedIndexedFields.SchemaId) .Should() .Id(id, FixedIndexedFields.EntityId) .Compile()); addItemsToDeleteQueue(entities); //now, check if the item being deleted is an attribute type, if it is we need to remove all AttributeDefinitions associated // with it and then all TypedAttribute fields belonging to the TypedEntity that reference these AttributeDefinitions var attributeDefs = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Must() .Id(id, FixedIndexedFields.AttributeTypeId) .Must() .EntityType <AttributeDefinition>() .Compile()); addItemsToDeleteQueue(attributeDefs); //now that we have the attribute defintions related to the typed attribute being deleted, we need to actually create new revisions // for any entity that had a schemas with these definitions on them. var schemaIds = attributeDefs.Select(x => x.Fields[FixedIndexedFields.SchemaId]).Distinct(); foreach (var schemaId in schemaIds) { var criteria = ExamineManager.CreateSearchCriteria() .Must().EntityType <TypedEntity>() .Must().Id(schemaId, FixedIndexedFields.SchemaId) //need to lookup latest because when we're supporting revisions, we will have more than one version of a TypedEntity .Must().Range(FixedRevisionIndexFields.IsLatest, 1, 1); var latest = FilterLatestTypedEntities( ExamineManager.Search(criteria.Compile())); //now that we have the latest TypedEntity for any Schema that had an AttributeDefinition on it that we are deleting // because we are deleting it's TypedAttribute, we need to make a new revision of //NOTE: If for some reason Revisions are disabled, this wont work foreach (var l in latest) { //now that we have an entity, we'll loop through the attribute defs were removing an ensure it's fields are removed foreach (var d in attributeDefs) { //remove all attributes starting with the prefix and attribute def alias var d1 = d; l.Fields.RemoveAll(x => x.Key.StartsWith(FixedAttributeIndexFields.AttributePrefix + d1.Fields[FixedIndexedFields.Alias])); //conver the fields to be used in an index operation var opFields = l.Fields.ToLazyDictionary(x => new ItemField(x)); //update some manual fields like the dates and revision ids StoreDateTimeOffset(FixedIndexedFields.UtcModified, opFields, DateTimeOffset.UtcNow); var revId = Guid.NewGuid().ToString("N"); opFields.AddOrUpdate(FixedRevisionIndexFields.RevisionId, new Lazy <ItemField>(() => new ItemField(revId)), (key, o) => new Lazy <ItemField>(() => new ItemField(revId))); //need to generate a new id (which is composite) var l1 = l; var op = new LinearHiveIndexOperation { OperationType = IndexOperationType.Add, Id = new Lazy <string>(() => l1.Fields[FixedIndexedFields.EntityId] + "," + revId), Fields = opFields }; //create the new revision without the fields transaction.EnqueueIndexOperation(op); } } } //finally, lookup the item itself and remove it var item = ExamineManager.Search(ExamineManager.CreateSearchCriteria().Must().Id(id).Compile()); addItemsToDeleteQueue(item); }
/// <summary> /// Initializes a new instance of the <see cref="FastTrackShippingAddressModelFactory"/> class. /// </summary> /// <param name="shippingContext"> /// The <see cref="IShippingContext"/>. /// </param> public FastTrackShippingAddressModelFactory(IShippingContext shippingContext) { Mandate.ParameterNotNull(shippingContext, "shippingContext"); _shippingContext = shippingContext; }
/// <summary> /// Gets the parent of the current Content entity relationships /// </summary> /// <param name="collection"></param> /// <returns></returns> public static File ParentAsFile(this EntityRelationCollection collection) { Mandate.ParameterNotNull(collection, "collection"); return(collection.Parent <File>(FixedRelationTypes.FileRelationType)); }
public EnsureUserPermissionForMediaAttribute(string paramName, DictionarySource source) { Mandate.ParameterNotNullOrEmpty(paramName, "paramName"); _paramName = paramName; _source = source; }
/// <summary> /// Gets the decendents or self of the current Content entity relationships /// </summary> /// <param name="collection"></param> /// <returns></returns> public static IEnumerable <File> DescendentsOrSelfAsFile(this EntityRelationCollection collection) { Mandate.ParameterNotNull(collection, "collection"); return(collection.DescendentsOrSelf <File>(FixedRelationTypes.FileRelationType)); }
public Task <NoticeRecord> Remind(string employeeIdentifier, Mandate mandate, Guid notificationId, string alternateEmailAdderss) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="ExtendedLoggerData"/> class. /// </summary> /// <param name="logger"> /// The logger. /// </param> public ExtendedLoggerData(ILogger logger) { Mandate.ParameterNotNull(logger, "logger"); _logger = logger; }
public Task <NoticeRecord> UploadNotification(string principalIdentifier, string emailAddress, string notificationFilePath, Mandate mandate, string purpose) { throw new NotImplementedException(); }
public UserGroupUsersEditor(IBackOfficeRequestContext backOfficeRequestContext) { Mandate.ParameterNotNull(backOfficeRequestContext, "backOfficeRequestContext"); _backOfficeRequestContext = backOfficeRequestContext; }
/// <summary> /// Compares the current object with another object of the same type. /// </summary> /// <returns> /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the <paramref name="other"/> parameter.Zero This object is equal to <paramref name="other"/>. Greater than zero This object is greater than <paramref name="other"/>. /// </returns> /// <param name="other">An object to compare with this object.</param> public int CompareTo(TypedAttributeName other) { Mandate.ParameterNotNull(other, "other"); return(string.Compare(other.Alias, Alias, StringComparison.InvariantCultureIgnoreCase)); }
public ContentEditorModel(HiveId id) : this() { Mandate.ParameterNotEmpty(id, "id"); Id = id; }
/// <summary> /// Initializes the provider and ensures that all configuration can be read /// </summary> /// <param name="builderContext"></param> public override void Initialise(IBuilderContext builderContext) { Mandate.ParameterNotNull(builderContext, "builderContext"); var configMain = builderContext.ConfigurationResolver.GetConfigSection(HiveConfigSection.ConfigXmlKey) as HiveConfigSection; if (configMain == null) { throw new ConfigurationErrorsException( string.Format("Configuration section '{0}' not found when building packaging provider '{1}'", HiveConfigSection.ConfigXmlKey, ProviderKey)); } var config2Rw = RegistryConfigElement ?? configMain.Providers.ReadWriters[ProviderKey] ?? configMain.Providers.Readers[ProviderKey]; if (config2Rw == null) { throw new ConfigurationErrorsException( string.Format("No configuration found for persistence provider '{0}'", ProviderKey)); } //get the Hive provider config section _localConfig = DeepConfigManager.Default.GetFirstPluginSection <ProviderConfigurationSection>(config2Rw.ConfigSectionKey); if (!ValidateProviderConfigSection <ExamineDemandBuilder>(_localConfig, config2Rw)) { CanBuild = false; return; } var configMgr = DeepConfigManager.Default; //get the internal indexer provider _internalIndexer = configMgr.GetFirstPluginSetting <ExamineSettings, ProviderSettings>("examine/examine.settings", x => x.IndexProviders.SingleOrDefault(indexer => indexer.Name == _localConfig.InternalIndexer)); if (_internalIndexer == null) { LogHelper.Warn <ExamineDemandBuilder>("Could not load UmbracoInternalIndexer, the configuration section could not be read."); CanBuild = false; return; } //get the internal searcher provider _internalSearcher = configMgr.GetFirstPluginSetting <ExamineSettings, ProviderSettings>("examine/examine.settings", x => x.SearchProviders.SingleOrDefault(indexer => indexer.Name == _localConfig.InternalSearcher)); if (_internalSearcher == null) { LogHelper.Warn <ExamineDemandBuilder>("Could not load UmbracoInternalSearcher, the configuration section could not be read."); CanBuild = false; return; } //get the internal index set to use for the searcher/indexer _internalIndexSet = configMgr.GetFirstPluginSetting <IndexSets, IndexSet>("examine/examine.indexes", x => x.SingleOrDefault(set => set.SetName == _localConfig.InternalIndexSet)); if (_internalIndexSet == null) { LogHelper.Warn <ExamineDemandBuilder>("Could not load UmbracoInternalIndexSet, the configuration section could not be read."); CanBuild = false; return; } CanBuild = true; }
/// <summary> /// Finds a map handler that can map from the type of <paramref name="source"/>, to a target type that is equal to or inherits from <typeparamref name="T"/>. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">The source.</param> /// <returns></returns> /// <remarks></remarks> public T MapToIntent <T>(object source) where T : class { Mandate.ParameterNotNull(source, "source"); return((T)MapToIntent(source, typeof(T))); }
/// <summary> /// Initializes a new instance of the <see cref="OfferManagerBase{TOffer}"/> class. /// </summary> /// <param name="offerSettingsService"> /// The <see cref="IOfferSettingsService"/>. /// </param> protected OfferManagerBase(IOfferSettingsService offerSettingsService) { Mandate.ParameterNotNull(offerSettingsService, "offerSettingsService"); _offerSettingsService = offerSettingsService; }