public override CodeStatementCollection BuildOperation(CodeGenerationContext ctx, ICodeGeneratorNode element, CodeVariableReferenceExpression value) { CodeStatementCollection statemets = new CodeStatementCollection(); statemets.Add(new CodeSnippetExpression( string.Format("{0} = ({2})((int){0} >> {1})", value.VariableName, Value, GetValueType(element.MappedProperty).FullName))); return statemets; }
public CodeMemberMethod NewElementMappingMethod(CodeGenerationContext ctx, ICodeGeneratorNode element) { CodeMemberMethod method = AddNewMethod(); element.GenerateMappingCode(ctx, method); return(method); }
public override void GenerateMappingCode(CodeGenerationContext ctx, CodeMemberMethod method) { if (!string.IsNullOrEmpty(_key)) { ICodeGeneratorNode element = ctx.MapInfo.GetNamedMapping(_key); Guard.NotNull(element, "Named mapping '{0}' not found for {1}", _key, ctx.MappedObjectType.FullName); element.To = To; element.GenerateMappingCode(ctx, method); } }
public virtual CodeStatementCollection BuildOperation(CodeGenerationContext ctx, ICodeGeneratorNode element, CodeVariableReferenceExpression value) { CodeStatementCollection statemets = new CodeStatementCollection(); if (!string.IsNullOrEmpty(_property)) { CodeExpression rightExpression = new CodePropertyReferenceExpression(ctx.MappedObject, _property); if (_index != null && element.MappedProperty.PropertyType.IsArray) { rightExpression = new CodeIndexerExpression(rightExpression, new CodePrimitiveExpression(_index.Value)); } statemets.Add(new CodeAssignStatement(value, new CodeCastExpression(GetValueType(element.MappedProperty), new CodeBinaryOperatorExpression(value, OperationType, rightExpression)))); } if (Value != null) { statemets.Add(new CodeAssignStatement(value, new CodeCastExpression(element.MappedProperty.PropertyType, new CodeBinaryOperatorExpression(value, OperationType, new CodePrimitiveExpression(Value))))); } return(statemets); }
public override CodeStatementCollection BuildOperation(CodeGenerationContext ctx, ICodeGeneratorNode element, CodeVariableReferenceExpression value) { CodeStatementCollection statemets = new CodeStatementCollection(); statemets.Add(new CodeSnippetExpression( string.Format("{0} = ({2})((int){0} >> {1})", value.VariableName, Value, GetValueType(element.MappedProperty).FullName))); return(statemets); }