Example #1
0
 /// <summary>
 /// Initializes a new instance of <see cref="CrowHost"/>.
 /// </summary>
 /// <param name="log">Instance of logger.</param>
 /// <param name="convention">Naming convention instance.</param>
 /// <param name="container">Dependency injection container.</param>
 /// <param name="configuration">Configuration helper.</param>
 /// <param name="host">Http host instance.</param>
 public CrowHost(ILog log, INamingConvention convention,
                 IInjectionContainer container,
                 IConfigurationHelper configuration,
                 IHttpHost host)
     : base(log, convention, container, configuration, host)
 {
 }
 public BusinessControllerBase SelectBusinessController(HttpRequestMessage request, ITypeListHost host, INamingConvention convention, IInjectionContainer container)
 {
     UrlParser url = new UrlParser(request.RequestUri.ToString());
     Type controllerType = host.BusinessTypeList[url.BusinessClass];
     var instance = container.Resolve(controllerType);
     return new CrowBusinessController(instance, url, convention);
 }
        public FullObjectGraphTraversalStrategy(Serializer serializer, ITypeInspector typeDescriptor, ITypeResolver typeResolver, int maxRecursion, INamingConvention namingConvention)
        {
            if (maxRecursion <= 0)
            {
                throw new ArgumentOutOfRangeException("maxRecursion", maxRecursion, "maxRecursion must be greater than 1");
            }

            this.serializer = serializer;

            if (typeDescriptor == null)
            {
                throw new ArgumentNullException("typeDescriptor");
            }

            this.typeDescriptor = typeDescriptor;

            if (typeResolver == null)
            {
                throw new ArgumentNullException("typeResolver");
            }

            this.typeResolver = typeResolver;

            this.maxRecursion = maxRecursion;
            this.namingConvention = namingConvention;
        }
Example #4
0
 public string GetStr(INamingConvention naming)
 {
     if (!string.IsNullOrEmpty(Alias))
         return Alias;
     else if (IsNonConsecutiveList)
         return naming.Apply(Name).Singularize(Plurality.CouldBeEither);
     else
         return naming.Apply(Name);
 }
Example #5
0
 public BusinessControllerBase(object instance, UrlParser url, INamingConvention convention)
 {
     _BusinessInstance = instance;
     _BusinessInstance.ThrowIfNull("instance");
     _UrlInformation = url;
     _UrlInformation.ThrowIfNull("url");
     _namingConvention = convention;
     _namingConvention.ThrowIfNull("convention");
 }
 public void SetUp()
 {
     config = new LauncherConfiguration
         {
             ApplicationExe = "Test.App.exe",
             UpdatesLocation = "ftp://*****:*****@ftp.test.com/remotedir"
         };
     ftp = MockRepository.GenerateMock<IFtpAccessor>();
     namingConvention = new DefaultNamingConvention();
 }
Example #7
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="options">Options that control how the serialization is to be performed.</param>
		/// <param name="namingConvention">Naming strategy to use for serialized property names</param>
		public Serializer(SerializationOptions options = SerializationOptions.None, INamingConvention namingConvention = null)
		{
			this.options = options;
			this.namingConvention = namingConvention ?? new NullNamingConvention();

			Converters = new List<IYamlTypeConverter>();

			typeResolver = IsOptionSet(SerializationOptions.DefaultToStaticType)
				? (ITypeResolver)new StaticTypeResolver()
				: (ITypeResolver)new DynamicTypeResolver();
		}
Example #8
0
        /// <summary>
        /// Initializes a new instance of <see cref="CrowBusinessHandler"/>.
        /// </summary>
        public CrowBusinessHandler(ITypeListHost host,
                                    INamingConvention convention,
                                    IInjectionContainer container)
        {
            _host = host;
            _host.ThrowIfNull("host");

            _convention = convention;
            _convention.ThrowIfNull("convention");

            _container = container;
            _container.ThrowIfNull("container");
        }
Example #9
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="options">Options that control how the serialization is to be performed.</param>
		/// <param name="namingConvention">Naming strategy to use for serialized property names</param>
		public Serializer(SerializationOptions options = SerializationOptions.None, INamingConvention namingConvention = null)
		{
			this.options = options;
			this.namingConvention = namingConvention ?? new NullNamingConvention();

			Converters = new List<IYamlTypeConverter>();
            foreach (IYamlTypeConverter yamlTypeConverter in Utilities.YamlTypeConverters.BuiltInConverters)
		    {
		        Converters.Add(yamlTypeConverter);
		    }
            
			typeResolver = IsOptionSet(SerializationOptions.DefaultToStaticType)
				? (ITypeResolver)new StaticTypeResolver()
				: (ITypeResolver)new DynamicTypeResolver();
		}
        public ExtensibleNamingConventionTypeInspector(IExtensibleTypeInspector innerTypeDescriptor, INamingConvention namingConvention)
        {
            if (innerTypeDescriptor == null)
            {
                throw new ArgumentNullException(nameof(innerTypeDescriptor));
            }

            this.innerTypeDescriptor = innerTypeDescriptor;

            if (namingConvention == null)
            {
                throw new ArgumentNullException(nameof(namingConvention));
            }

            this.namingConvention = namingConvention;
        }
Example #11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="options">Options that control how the serialization is to be performed.</param>
        /// <param name="namingConvention">Naming strategy to use for serialized property names</param>
        /// <param name="overrides">Yaml attribute overrides</param>
        public Serializer(SerializationOptions options = SerializationOptions.None, INamingConvention namingConvention = null, YamlAttributeOverrides overrides = null)
        {
            this.options = options;
            this.namingConvention = namingConvention ?? new NullNamingConvention();
            this.overrides = overrides;

            Converters = new List<IYamlTypeConverter>();
            foreach (IYamlTypeConverter yamlTypeConverter in Utilities.YamlTypeConverters.GetBuiltInConverters(IsOptionSet(SerializationOptions.JsonCompatible)))
            {
                Converters.Add(yamlTypeConverter);
            }

            typeResolver = IsOptionSet(SerializationOptions.DefaultToStaticType)
                ? (ITypeResolver)new StaticTypeResolver()
                : (ITypeResolver)new DynamicTypeResolver();
        }
        public NamingConventionTypeInspector(ITypeInspector innerTypeDescriptor, INamingConvention namingConvention)
        {
            if (innerTypeDescriptor == null)
            {
                throw new ArgumentNullException("innerTypeDescriptor");
            }

            this.innerTypeDescriptor = innerTypeDescriptor;

            if (namingConvention == null)
            {
                throw new ArgumentNullException("namingConvention");
            }

            this.namingConvention = namingConvention;
        }
Example #13
0
 public static void AssertTemplateResult(string expected, string template, INamingConvention namingConvention)
 {
     AssertTemplateResult(expected: expected, template: template, anonymousObject: null, namingConvention: namingConvention);
 }
 private void ShouldApplyConventionGiven(string input, string expectedName, INamingConvention convention)
 {
     convention.Apply(input).Should().Be(expectedName);
 }
 public string GetLastVersionFilename(INamingConvention namingConvention)
 {
     var fileList = Directory.GetFiles(configuration.UpdatesLocation)
         .Select(x => Path.GetFileName(x));
     return namingConvention.GetLastVersionFilename(fileList, configuration);
 }
Example #16
0
 internal AdvancedEnumConverter([NotNull] INamingConvention namingConvention)
 {
     _namingConvention = namingConvention;
 }
Example #17
0
 public string GetLastVersionFilename(INamingConvention namingConvention)
 {
     var fileList = ftp.ListFiles() ?? new string[] {};
     var lastNewFilename = namingConvention.GetLastVersionFilename(fileList, configuration);
     return lastNewFilename;
 }
Example #18
0
            public BackwardsCompatibleConfiguration(SerializationOptions options, INamingConvention namingConvention, YamlAttributeOverrides overrides)
            {
                this.options = options;
                this.namingConvention = namingConvention ?? new NullNamingConvention();
                this.overrides = overrides;

                Converters = new List<IYamlTypeConverter>();
                Converters.Add(new GuidConverter(IsOptionSet(SerializationOptions.JsonCompatible)));

                typeResolver = IsOptionSet(SerializationOptions.DefaultToStaticType)
                    ? (ITypeResolver)new StaticTypeResolver()
                    : (ITypeResolver)new DynamicTypeResolver();
            }
Example #19
0
 public NameSplitMember()
 {
     SourceMemberNamingConvention = new PascalCaseNamingConvention();
     DestinationMemberNamingConvention = new PascalCaseNamingConvention();
 }
Example #20
0
 public SqlGenerator(TableInfo tableInfo, INamingConvention namingConvention)
 {
     _tableInfo        = tableInfo;
     _namingConvention = namingConvention;
 }
 public ExRelationSerializer(SerializationOptions options = SerializationOptions.None,
                             INamingConvention namingConvention = null)
     : base(options, namingConvention) { }
Example #22
0
 public NamingConventionAsync(INamingConvention <TResult> namingConvention)
 {
     _namingConvention = namingConvention;
 }
Example #23
0
 public static Task <TOutput> RunCheckpointAsync <TInput, TOutput>(this ICheckpointRunner runner, string key, ISandboxedCheckpoint <TInput, TOutput> wrapper, TInput input,
                                                                   INamingConvention <TOutput> namingConvention)
 {
     return(runner.RunCheckpointAsync(key, dir => wrapper.Run(input, dir), namingConvention));
 }
Example #24
0
 public Serializer(SerializationOptions options = SerializationOptions.None, INamingConvention namingConvention = null, YamlAttributeOverrides overrides = null)
 {
     backwardsCompatibleConfiguration = new BackwardsCompatibleConfiguration(options, namingConvention, overrides);
 }
Example #25
0
 public CheckForInvalidNamesDecorator(INamingConvention realConvention)
 {
     _realConvention    = realConvention;
     _defaultConvention = new NamingConvention();
 }
Example #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotLiquidViewEngine"/> class.
 /// </summary>
 /// <param name="fileSystemFactory">Factory used to retrieve the <see cref="IFileSystem"/> instance that should be used by the engine.</param>
 /// <param name="namingConvention">The naming convention used by filters and DotLiquid's <c>Drop</c>s</param>
 public DotLiquidViewEngine(IFileSystemFactory fileSystemFactory, INamingConvention namingConvention)
 {
     this.fileSystemFactory = fileSystemFactory;
     this.namingConvention = namingConvention;
 }
Example #27
0
 public CrowBusinessController(object businessInstance, UrlParser url, INamingConvention convention)
     : base(businessInstance, url, convention)
 {
 }
Example #28
0
 public BusinessInvoker(ITypeListHost host, INamingConvention convention, IInjectionContainer container)
 {
     _host = host;
     _convention = convention;
     _container = container;
 }
Example #29
0
        public YamlDeserializer(
            IObjectFactory objectFactory       = null,
            INamingConvention namingConvention = null,
            bool ignoreUnmatched      = false,
            bool ignoreNotFoundAnchor = true)
        {
            objectFactory    = objectFactory ?? new DefaultEmitObjectFactory();
            namingConvention = namingConvention ?? new NullNamingConvention();

            _typeDescriptor.TypeDescriptor =
                new ExtensibleYamlAttributesTypeInspector(
                    new ExtensibleNamingConventionTypeInspector(
                        new ExtensibleReadableAndWritablePropertiesTypeInspector(
                            new EmitTypeInspector(
                                new StaticTypeResolver()
                                )
                            ),
                        namingConvention
                        )
                    );

            _converters = new List <IYamlTypeConverter>();
            foreach (IYamlTypeConverter yamlTypeConverter in YamlTypeConverters.BuiltInConverters)
            {
                _converters.Add(yamlTypeConverter);
            }

            NodeDeserializers = new List <INodeDeserializer>();
            NodeDeserializers.Add(new TypeConverterNodeDeserializer(_converters));
            NodeDeserializers.Add(new NullNodeDeserializer());
            NodeDeserializers.Add(new ScalarNodeDeserializer());
            NodeDeserializers.Add(new EmitArrayNodeDeserializer());
            NodeDeserializers.Add(new EmitGenericDictionaryNodeDeserializer(objectFactory));
            NodeDeserializers.Add(new DictionaryNodeDeserializer(objectFactory));
            NodeDeserializers.Add(new EmitGenericCollectionNodeDeserializer(objectFactory));
            NodeDeserializers.Add(new CollectionNodeDeserializer(objectFactory));
            NodeDeserializers.Add(new EnumerableNodeDeserializer());
            NodeDeserializers.Add(new ExtensibleObjectNodeDeserializer(objectFactory, _typeDescriptor, ignoreUnmatched));

            _tagMappings  = new Dictionary <string, Type>(PredefinedTagMappings);
            TypeResolvers = new List <INodeTypeResolver>();
            TypeResolvers.Add(new TagNodeTypeResolver(_tagMappings));
            TypeResolvers.Add(new TypeNameInTagNodeTypeResolver());
            TypeResolvers.Add(new DefaultContainersNodeTypeResolver());
            TypeResolvers.Add(new ScalarYamlNodeTypeResolver());

            if (ignoreNotFoundAnchor)
            {
                _valueDeserializer =
                    new LooseAliasValueDeserializer(
                        new NodeValueDeserializer(
                            NodeDeserializers,
                            TypeResolvers
                            )
                        );
            }
            else
            {
                _valueDeserializer =
                    new AliasValueDeserializer(
                        new NodeValueDeserializer(
                            NodeDeserializers,
                            TypeResolvers
                            )
                        );
            }
        }
Example #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotLiquidViewEngine"/> class.
 /// </summary>
 /// <param name="namingConvention">Determines the DotLiquid naming convention that will be used for filters and Drops. This will default to the <c>RubyNamingConvention</c>.</param>
 /// <remarks>The instance will use the <see cref="DefaultFileSystemFactory"/> internally.</remarks>
 public DotLiquidViewEngine(INamingConvention namingConvention)
     : this(new DefaultFileSystemFactory(), namingConvention)
 {
 }
Example #31
0
 public Serializer(SerializationOptions options = SerializationOptions.None, INamingConvention namingConvention = null, YamlAttributeOverrides overrides = null)
 {
     backwardsCompatibleConfiguration = new BackwardsCompatibleConfiguration(options, namingConvention, overrides);
 }
Example #32
0
        public static void AssertTemplateResult(string expected, string template, Hash localVariables, INamingConvention namingConvention)
        {
            //Have to lock Template.NamingConvention for this test to
            //prevent other tests from being run simultaneously that
            //require the default naming convention.
            var currentNamingConvention = Template.NamingConvention;

            lock (Template.NamingConvention)
            {
                Template.NamingConvention = namingConvention;

                try
                {
                    AssertTemplateResult(expected, template, localVariables);
                }
                finally
                {
                    Template.NamingConvention = currentNamingConvention;
                }
            }
        }
Example #33
0
 public void Render(object data, TextWriter writer, TemplateLocator templateLocator,
     INamingConvention namingConvention)
 {
     Render(data, writer, templateLocator,
         new ValueProviderCollection(namingConvention));
 }
Example #34
0
 public ResourceMerger(INamingConvention namingConvention)
 {
     NamingConvention = namingConvention;
 }
Example #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotLiquidViewEngine"/> class.
 /// </summary>
 /// <param name="fileSystemFactory">Factory used to retrieve the <see cref="IFileSystem"/> instance that should be used by the engine.</param>
 /// <param name="namingConvention">The naming convention used by filters and DotLiquid's <c>Drop</c>s</param>
 public DotLiquidViewEngine(IFileSystemFactory fileSystemFactory, INamingConvention namingConvention)
 {
     this.fileSystemFactory = fileSystemFactory;
     this.namingConvention  = namingConvention;
 }
 public NameSplitMember()
 {
     SourceMemberNamingConvention      = new PascalCaseNamingConvention();
     DestinationMemberNamingConvention = new PascalCaseNamingConvention();
 }
 /// <summary>
 ///     The transform index.
 /// </summary>
 /// <param name="index">
 ///     The index.
 /// </param>
 /// <returns>
 ///     The <see cref="string" />.
 /// </returns>
 public string TransformIndex(Index index, INamingConvention nc = null)
 {
     return(NhibernateDriverType.TransformIndex(index, nc));
 }
Example #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotLiquidViewEngine"/> class.
 /// </summary>
 /// <param name="namingConvention">Determines the DotLiquid naming convention that will be used for filters and Drops. This will default to the <c>RubyNamingConvention</c>.</param>
 /// <remarks>The instance will use the <see cref="DefaultFileSystemFactory"/> internally.</remarks>
 public DotLiquidViewEngine(INamingConvention namingConvention)
     : this(new DefaultFileSystemFactory(), namingConvention)
 {
 }
Example #39
0
        public FullObjectGraphTraversalStrategy(Serializer serializer, ITypeInspector typeDescriptor, ITypeResolver typeResolver, int maxRecursion, INamingConvention namingConvention)
        {
            if (maxRecursion <= 0)
            {
                throw new ArgumentOutOfRangeException("maxRecursion", maxRecursion, "maxRecursion must be greater than 1");
            }

            this.serializer = serializer;

            if (typeDescriptor == null)
            {
                throw new ArgumentNullException("typeDescriptor");
            }

            this.typeDescriptor = typeDescriptor;

            if (typeResolver == null)
            {
                throw new ArgumentNullException("typeResolver");
            }

            this.typeResolver = typeResolver;

            this.maxRecursion     = maxRecursion;
            this.namingConvention = namingConvention;
        }
Example #40
0
 public static void AssertTemplateResult(string expected, string template, object anonymousObject, INamingConvention namingConvention, SyntaxCompatibility syntax = SyntaxCompatibility.Liquid20)
 {
     LockTemplateStaticVars(namingConvention, () =>
     {
         var localVariables = anonymousObject == null ? null : Hash.FromAnonymousObject(anonymousObject);
         var parameters     = new RenderParameters(System.Globalization.CultureInfo.CurrentCulture)
         {
             LocalVariables           = localVariables,
             SyntaxCompatibilityLevel = syntax
         };
         Assert.AreEqual(expected, Template.Parse(template).Render(parameters));
     });
 }