示例#1
0
 void CopyTo(IIndexAccessor src, IIndexAccessor des)
 {
     foreach (var item in Names)
     {
         des[item] = src[item];
     }
 }
示例#2
0
        public ExpressionCompiler(IIndexAccessor index)
        {
            if (index == null)
                throw new ArgumentNullException("index");

            _index = index;
        }
        internal string ToDbType(IIndexAccessor indexAccessor)
        {
            if(indexAccessor.IsEnumerable && indexAccessor.DataType.IsEnumerableBytesType())
                throw new SisoDbException(
                    ExceptionMessages.SqlDbDataTypeTranslator_ByteArraysAreNotSupported.Inject(indexAccessor.Path));

            if(indexAccessor.IsElement)
                return ("[nvarchar](max)");

            return ToDbType(indexAccessor.DataType);
        }
	    protected virtual IIndexAccessor[] GetIndexAccessors(IStructureType structureType)
        {
        	var accessors = new IIndexAccessor[structureType.IndexableProperties.Length];

			for (var i = 0; i < accessors.Length; i++)
			{
			    var property = structureType.IndexableProperties[i];
			    accessors[i] = new IndexAccessor(property, DataTypeConverter.Convert(property));
			}

	        return accessors;
        }
示例#5
0
        protected virtual IIndexAccessor[] GetIndexAccessors(IStructureType structureType)
        {
            var accessors = new IIndexAccessor[structureType.IndexableProperties.Length];

            for (var i = 0; i < accessors.Length; i++)
            {
                var property = structureType.IndexableProperties[i];
                accessors[i] = new IndexAccessor(property, DataTypeConverter.Convert(property));
            }

            return(accessors);
        }
        public void Compile(IIndexAccessor index)
        {
            var compiler = new ExpressionCompiler(index);

            Expression<Func<IResolver, object>> compiledExpression;
            if (compiler.TryCompile(_expression, out compiledExpression))
            {
                SetFactory(compiledExpression);

                // Store Compiled Expression so it can be reused later if referenced from another registration instead of compiling it again ?
                // _compiledExpression = compiledExpression;
            }
        }
示例#7
0
        public bool AppendChildElementByEntity(ref XmlElement node, IIndexAccessor entity, string removecols)
        {
            if (node != null && node.OwnerDocument != null)
            {
                foreach (var pi in entity.GetType().GetProperties())
                {
                    if (!pi.CanRead || !pi.CanWrite)
                    {
                        continue;
                    }

                    if (String.IsNullOrEmpty(removecols) || ("," + removecols + ",").ToLower().IndexOf("," + pi.Name.ToLower() + ",") < 0)
                    {
                        var elm = node.OwnerDocument.CreateElement(pi.Name);
                        elm.InnerText = this.FiltrateControlCharacter((entity[pi.Name] + "").Trim());
                        node.AppendChild(elm);
                    }
                }
                return(true);
            }
            return(false);
        }
示例#8
0
        private static bool HasLevel(IIndexAccessor iac, int level)
        {
            var count = iac.Path.Count(ch => ch == '.');

            return(count == level);
        }
        private string GenerateColumnDefinition(IIndexAccessor iac)
        {
            var dataTypeAsString = _dataTypeTranslator.ToDbType(iac);

            return _columnGenerator.ToSql(iac.Name, dataTypeAsString);
        }
        protected virtual void OnAppendIndexAccessor(DiagnosticsGroup parent, IStructureSchema schema, IIndexAccessor indexAccessor)
        {
            var group = parent.AddGroup(indexAccessor.Path)
                        .AddNode("Path", indexAccessor.Path)
                        .AddNode("DataType", indexAccessor.DataType)

                        .AddNode("IsElement", indexAccessor.IsElement)
                        .AddNode("IsEnumerable", indexAccessor.IsEnumerable)
                        .AddNode("IsUnique", indexAccessor.IsUnique);

            if (indexAccessor.IsUnique && indexAccessor.UniqueMode.HasValue)
            {
                group.AddNode("UniqueMode", indexAccessor.UniqueMode.Value);
            }
        }
示例#11
0
 void CopyTo(IIndexAccessor src, IIndexAccessor des)
 {
     foreach (var item in Names)
     {
         des[item] = src[item];
     }
 }