public string GetMicroresolverBindCode(ScopeTypeEnum scope) { var suffix = GetSuffix(scope); return($@" container.Register<{InterfaceName}, {ClassName}>(Lifestyle.{suffix}); "); }
public string GetDryIocBindCode(ScopeTypeEnum scope) { var suffix = GetSuffix(scope); return($@" container.Register<{InterfaceName}, {ClassName}>(Reuse.{suffix}); "); }
public Variable(string var, string val, CodeObject parent, ScopeTypeEnum scope) { Parent = parent; AccessLevel = scope; Name = var; Value = val; Type = Helpers.GetType(val); //do parse work }
public void AddVariable(string var, string val, ScopeTypeEnum access) { var variable = new Variable(var, val, this, access); if (HasVariable(variable.Name) || Parent.HasVariable(variable.Name)) { SetVariable(var, val); } Variables.Add(variable); }
private void AddClass(ScopeTypeEnum access, string s) { var cls = new Class(access, s, this); if (HasClass(cls.Name)) { throw new Exception(string.Format("Cannot Create Class {0} class already exists.", cls.Name)); } Classes.Add(cls); }
private void AddVariable(ScopeTypeEnum access, string s) { var var = new Variable(s, this, access); if (HasVariable(var.Name)) { throw new Exception(string.Format("Cannot Create {0} Global Variable already exists.", var.Name)); } GlobalVariables.Add(var); }
private void AddVariable(string s, ScopeTypeEnum access) { var var = new Variable(s, this, access); if (HasVariable(var.Name) || Parent.HasVariable(var.Name)) { throw new Exception(string.Format("Cannot Create {0} Variable already exists.", var.Name)); } Variables.Add(new Variable(s, this, access)); }
private void AddMethod(string s, ScopeTypeEnum access) { var method = new Method(s, this, access); if (Methods.Any(x => x.Name == method.Name)) { throw new Exception(string.Format("Cannot Create {0} Method already exists.", method.Name)); } Methods.Add(method); }
public Class(ScopeTypeEnum access, string s, CodeObject parent) { Methods = new List <Method>(); Variables = new List <Variable>(); Lines = new List <Line>(); Parent = parent; AccessLevel = access; Name = ParseName(s); ParseCode(s); }
public Method(string s, CodeObject parent, ScopeTypeEnum access) { Variables = new List <Variable>(); Code = new List <Line>(); Parameters = new List <Parameters>(); Parent = parent; AccessLevel = access; Name = ParseName(s); ParseCode(s); //do parse work here }
public string GetDpdtBindCode(ScopeTypeEnum scope) { var suffix = GetSuffix(scope); return($@" Bind<{InterfaceName}>() .To<{ClassName}>() .With{suffix}Scope() ; "); }
/// <summary> /// 生成OAuth相关的URL /// </summary> /// <param name="para_URL"></param> /// <param name="scope">应用授权作用域 /// <param name="state">重定向后会带上state参数</param> /// <returns></returns> public string GetOAuth_URL(string para_URL, ScopeTypeEnum scope, string state) { string OAuth_URL = string.Empty; try { OAuth_URL = string.Format("https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id={0}&scope={1}&redirect_uri={2}&state={3}", config.app_id, scope.ToString(), System.Web.HttpUtility.UrlEncode(para_URL), state); } catch (Exception e) { log.Error(string.Format("Corp getOAuth_URL:"), e); } return(OAuth_URL); }
private static string GetSuffix(ScopeTypeEnum scope) { var suffix = ""; switch (scope) { case ScopeTypeEnum.Transient: suffix = "Transient"; break; case ScopeTypeEnum.Singleton: suffix = "Singleton"; break; default: throw new ArgumentOutOfRangeException(scope.ToString()); } return(suffix); }
private void AddMethod(string s, ScopeTypeEnum access) { var method = new Method(s, this, access); if (method.Name != "main") { if (Methods.Any(x => x.Name == method.Name)) { throw new Exception(string.Format("Cannot Create {0} Global Method already exists.", method.Name)); } Methods.Add(method); } else if (MainMethod != null) { throw new Exception("Ambiguos Main method found."); } else { MainMethod = method; } }
/// <summary> /// 获取Code码接口地址 /// </summary> /// <returns></returns> public static string OAuth2_AuthorizeUrl(string appkey, string redirect_uri, ScopeTypeEnum scope, string state = "STATE") { //https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect return($"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appkey}&redirect_uri={redirect_uri}&response_type=code&scope={scope.ToString()}&state={state}#wechat_redirect"); }
public Variable(string s, CodeObject parent, ScopeTypeEnum scope) { Parent = parent; AccessLevel = scope; //do parse work }