예제 #1
0
        public CombinatorResource(ResourceType type, IHttpContextAccessor httpContextAccessor)
        {
            _type        = type;
            _httpContext = httpContextAccessor.Current();

            RequiredContext = new ResourceRequiredContext();
            IsOriginal      = false;
        }
예제 #2
0
        public void FillRequiredContext(string name, string url, string culture = "", string condition = "", Dictionary <string, string> attributes = null)
        {
            var requiredContext  = new ResourceRequiredContext();
            var resourceManifest = new ResourceManifest();

            requiredContext.Resource = resourceManifest.DefineResource(Type.ToStringType(), name);
            requiredContext.Resource.SetUrl(url);
            requiredContext.Settings            = new RequireSettings();
            requiredContext.Settings.Culture    = culture;
            requiredContext.Settings.Condition  = condition;
            requiredContext.Settings.Attributes = attributes != null ? new Dictionary <string, string>(attributes) : new Dictionary <string, string>();
            RequiredContext = requiredContext;
        }
예제 #3
0
        public void FillRequiredContext(string name, string url, string culture = "", string condition = "", Dictionary <string, string> attributes = null, IDictionary <string, string> tagAttributes = null)
        {
            var requiredContext  = new ResourceRequiredContext();
            var resourceManifest = new ResourceManifest();

            requiredContext.Resource = resourceManifest.DefineResource(Type.ToStringType(), name);
            if (!string.IsNullOrEmpty(url))
            {
                requiredContext.Resource.SetUrl(url);
            }
            requiredContext.Settings = new RequireSettings
            {
                Name       = name,
                Culture    = culture,
                Condition  = condition,
                Attributes = attributes != null ? new Dictionary <string, string>(attributes) : new Dictionary <string, string>()
            };
            RequiredContext = requiredContext;

            if (tagAttributes != null)
            {
                requiredContext.Resource.TagBuilder.MergeAttributes(tagAttributes);
            }
        }
예제 #4
0
 public CombinatorResource GetResource(ResourceRequiredContext resource)
 {
     return((from r in Resources
             where r.Value.RequiredContext.Resource.Url == resource.Resource.Url
             select r.Value).First());
 }