private static void GenerateCallContextLookup(string nameValue, CodeMemberField field, CodeStatementCollection statements, CodeVariableReferenceExpression valueAcquired, CodeTypeReference typeReference, string typeValue) { CodeVariableDeclarationStatement codeVariableDeclarationStatement = typeof(object).Decl("data", typeof(CallContext).Expr().Call("LogicalGetData", nameValue.Prim())); CodeVariableReferenceExpression codeVariableReferenceExpression = codeVariableDeclarationStatement.Ref(); CodeAssignStatement codeAssignStatement = field.Ref().Assign(typeReference.Cast(codeVariableReferenceExpression)); CodeConditionStatement codeConditionStatement = new CodeConditionStatement(codeVariableReferenceExpression.NotNull(), codeAssignStatement); statements.Add(new CodeConditionStatement(valueAcquired.VEquals(false.Prim()), codeVariableDeclarationStatement, codeConditionStatement)); }
private static void GenerateCallContextLookup(string nameValue, CodeMemberField field, CodeStatementCollection statements, CodeVariableReferenceExpression valueAcquired, CodeTypeReference typeReference, string typeValue) { CodeVariableDeclarationStatement declaration = typeof(object).Decl("data", typeof(CallContext).Expr().Call("LogicalGetData", new CodeExpression[] { nameValue.Prim() })); CodeVariableReferenceExpression expression = declaration.Ref(); CodeAssignStatement statement2 = field.Ref().Assign(typeReference.Cast(expression)); CodeConditionStatement statement3 = new CodeConditionStatement(expression.NotNull(), new CodeStatement[] { GenerateTypeMismatchCheck(expression, nameValue, typeReference, typeValue, new CodeStatement[] { statement2 }) }); statements.Add(new CodeConditionStatement(valueAcquired.VEquals(false.Prim()), new CodeStatement[] { declaration, statement3 })); }
private static void GenerateSessionLookup(string nameValue, CodeMemberField field, CodeStatementCollection statements, CodeStatement setValueAcquired, CodeTypeReference typeReference) { CodeExpression value = new CodeIndexerExpression(new CodeThisReferenceExpression().Prop("Session"), nameValue.Prim()); statements.Add(new CodeConditionStatement(new CodeThisReferenceExpression().Prop("Session").Call("ContainsKey", nameValue.Prim()), field.Ref().Assign(typeReference.Cast(value)), setValueAcquired)); }
private static void GenerateSessionLookup(string nameValue, CodeMemberField field, CodeStatementCollection statements, CodeStatement setValueAcquired, CodeTypeReference typeReference, string typeValue) { CodeExpression variable = new CodeIndexerExpression(new CodeThisReferenceExpression().Prop("Session"), new CodeExpression[] { nameValue.Prim() }); statements.Add(new CodeConditionStatement(new CodeThisReferenceExpression().Prop("Session").Call("ContainsKey", new CodeExpression[] { nameValue.Prim() }), new CodeStatement[] { GenerateTypeMismatchCheck(variable, nameValue, typeReference, typeValue, new CodeStatement[] { field.Ref().Assign(typeReference.Cast(variable)), setValueAcquired }) })); }