protected virtual string WriteConstructFrom(IEntityOperationSymbolContainer oper) { List <Type> type = oper.GetType().GetGenericArguments().ToList(); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.ConstructFrom<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Construct = ({0}, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName())); sb.AppendLine(" {"); sb.AppendLine(" }"); sb.AppendLine("}.Register();"); return(sb.ToString()); }
protected virtual string WriteDeleteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); string v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Delete = ({0}, _) => {0}.Delete()".FormatWith(v)); sb.AppendLine("}.Register();"); return(sb.ToString()); }
protected virtual string WriteExecuteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); var v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); if (IsSave(oper)) { sb.AppendLine(" AllowsNew = true,"); sb.AppendLine(" Lite = false,"); } sb.AppendLine(" Execute = ({0}, _) => {{ }}".FormatWith(v)); sb.AppendLine("}.Register();"); return(sb.ToString()); }
protected virtual string WriteConstructFrom(IEntityOperationSymbolContainer oper) { List<Type> type = oper.GetType().GetGenericArguments().ToList(); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.ConstructFrom<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Construct = ({0}, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName())); sb.AppendLine(" {"); sb.AppendLine(" }"); sb.AppendLine("}.Register();"); return sb.ToString(); }
protected virtual string WriteDeleteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); string v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Delete = ({0}, _) => {0}.Delete()".FormatWith(v)); sb.AppendLine("}.Register();"); return sb.ToString(); }
protected virtual string WriteExecuteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); var v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); if (IsSave(oper)) { sb.AppendLine(" AllowsNew = true,"); sb.AppendLine(" Lite = false,"); } sb.AppendLine(" Execute = ({0}, _) => {{ }}".FormatWith(v)); sb.AppendLine("}.Register();"); return sb.ToString(); }