本文整理汇总了C#中MethodType类的典型用法代码示例。如果您正苦于以下问题:C# MethodType类的具体用法?C# MethodType怎么用?C# MethodType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodType类属于命名空间,在下文中一共展示了MethodType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Name
public Name(string methodName, string className, MethodType type, bool interesting)
{
MethodName = methodName;
ClassName = className;
Type = type;
Interesting = interesting;
}
示例2: getOperationMethodName
public static string getOperationMethodName(this DbSetInfo dbSetInfo, MethodType methodType)
{
switch (methodType)
{
case MethodType.Refresh:
if (string.IsNullOrWhiteSpace(dbSetInfo.refreshDataMethod))
return null;
return GenerateMethodName(dbSetInfo.refreshDataMethod, dbSetInfo.dbSetName);
case MethodType.Insert:
if (string.IsNullOrWhiteSpace(dbSetInfo.insertDataMethod))
return null;
return GenerateMethodName(dbSetInfo.insertDataMethod, dbSetInfo.dbSetName);
case MethodType.Update:
if (string.IsNullOrWhiteSpace(dbSetInfo.updateDataMethod))
return null;
return GenerateMethodName(dbSetInfo.updateDataMethod, dbSetInfo.dbSetName);
case MethodType.Delete:
if (string.IsNullOrWhiteSpace(dbSetInfo.deleteDataMethod))
return null;
return GenerateMethodName(dbSetInfo.deleteDataMethod, dbSetInfo.dbSetName);
case MethodType.Validate:
if (string.IsNullOrWhiteSpace(dbSetInfo.validateDataMethod))
return null;
return GenerateMethodName(dbSetInfo.validateDataMethod, dbSetInfo.dbSetName);
default:
throw new DomainServiceException(string.Format("Invalid Method Type {0}", methodType));
}
}
示例3: CreateDatabase
private static Database CreateDatabase(MethodType type)
{
switch (type)
{
case MethodType.One:
{
// Should only exist one DatabaseProviderFactory object in your application,
// since all the Database objects are cached in the factory
var factory = new DatabaseProviderFactory();
return factory.CreateDefault();
}
case MethodType.Two:
{
var factory = new DatabaseProviderFactory();
DatabaseFactory.SetDatabaseProviderFactory(factory);
return DatabaseFactory.CreateDatabase();
}
case MethodType.Three:
{
var factory = new DatabaseProviderFactory();
DatabaseFactory.SetDatabaseProviderFactory(factory);
return DatabaseFactory.CreateDatabase("LocalDb");
}
case MethodType.Four:
{
return new SqlDatabase(ConfigurationManager.ConnectionStrings["LocalDb"].ConnectionString);
}
default:
throw new NotSupportedException();
}
}
示例4: ProxyMethodInfo
public ProxyMethodInfo(string methodName, string typeName, Type fakeType, MethodInfo fakeMethod, MethodType fakeMethodType)
: this(methodName, typeName)
{
FakeMethodType = fakeMethodType;
FakeMethod = fakeMethod;
FakeType = fakeType;
}
示例5: Request
public static void Request(MethodType method, string uri, string body, CallBack<string> callBack)
{
try
{
Init("8aa5b8b5-f769-11e3-954e-06a6fa0000b9", "6ef2e5c0-3ef1-11e4-ae91-06a6fa0000b9");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(APIEndpoint + uri);
request.Method = method.ToString();
request.ContentType = "applications/json";
if (PlayerPrefs.HasKey("access_token"))
request.Headers["Authorization"] = "Bearer " + PlayerPrefs.GetString("access_token");
if(request.Method == "POST" || request.Method == "PUT")
{
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(body);
writer.Close();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
callBack(responseFromServer);
}
catch(Exception e)
{
Debug.Log(e.Message);
}
}
示例6: GenerateSignature
/// <summary>
/// Generates the signature.
/// </summary>
/// <param name="t">The tokens.</param>
/// <param name="httpMethod">The HTTP method.</param>
/// <param name="url">The URL.</param>
/// <param name="prm">The parameters.</param>
/// <returns>The signature.</returns>
internal static string GenerateSignature(Tokens t, MethodType httpMethod, Uri url, IEnumerable<KeyValuePair<string, string>> prm)
{
var key = Encoding.UTF8.GetBytes(
string.Format("{0}&{1}", UrlEncode(t.ConsumerSecret),
UrlEncode(t.AccessTokenSecret)));
var prmstr = prm.Select(x => new KeyValuePair<string, string>(UrlEncode(x.Key), UrlEncode(x.Value)))
.Concat(
url.Query.TrimStart('?').Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x =>
{
var s = x.Split('=');
return new KeyValuePair<string, string>(s[0], s[1]);
})
)
.OrderBy(x => x.Key).ThenBy(x => x.Value)
.Select(x => x.Key + "=" + x.Value)
.JoinToString("&");
var msg = Encoding.UTF8.GetBytes(
string.Format("{0}&{1}&{2}",
httpMethod.ToString().ToUpperInvariant(),
UrlEncode(url.GetComponents(UriComponents.Scheme | UriComponents.UserInfo | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.UriEscaped)),
UrlEncode(prmstr)
));
return Convert.ToBase64String(SecurityUtils.HmacSha1(key, msg));
}
示例7: CommonParameters
public CommonParameters(MethodType method, bool verifyOriginator = false)
{
Id = RandomNumberGenerator.Instance.Next();
MethodType = method;
VerifyOriginator = verifyOriginator;
}
示例8: Method
/// <summary>
/// Initializes a new <see cref="Method"/> instance with the given parameters.
/// </summary>
/// <param name="moduleId">The ID of the module the symbol resides in.</param>
/// <param name="type">The type of the method.</param>
/// <param name="address">The start address of the method.</param>
/// <param name="length">The length of the method, in bytes.</param>
public Method( uint moduleId, MethodType type, uint address, uint length )
: base(moduleId, address, length)
{
this.Type = type;
//Debug.Assert( address % 4 == 0 );
Debug.Assert( length % 4 == 0 );
}
示例9: CreateMethodParamList
public static List<string> CreateMethodParamList(MethodType Methodtype, string Tablename, List<string> Colnames, string Namespace)
{
List<string> lines = new List<string>();
List<string> propertyInfos = new List<string>();
var typeMap = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => t.Namespace == Namespace)
.ToDictionary(t => t.Name, t => t,
StringComparer.OrdinalIgnoreCase);
Type type;
if (typeMap.TryGetValue(Tablename.Trim(), out type))
{
try
{
var cls = Activator.CreateInstance(type);
foreach (var prop in cls.GetType().GetProperties())
{
propertyInfos.Add(prop.Name);
}
}
catch(Exception ex)
{
Console.WriteLine(string.Format("Error:{0}", ex));
}
}
else
{
Console.WriteLine("Type not found");
}
var i = 0;
foreach (var s in Colnames)
{
switch (Methodtype)
{
case MethodType.Insert:
lines.Add(string.Format("fbCom.Parameters.AddWithValue(\"@{0}\", {1}.{2});", s, Tablename, propertyInfos[i]));
break;
case MethodType.Select:
lines.Add(string.Format("fbCom.Parameters.AddWithValue(\"@{0}\", {1});", s, propertyInfos[i].ToUpper()));
return lines;
//case MethodType.Update:
// lines.Add(string.Format("fbCom.Parameters.AddWithValue(\"{0}\", {1}.{2});", s, Tablename, propertyInfos[i]));
// break;
case MethodType.Delete:
lines.Add(string.Format("fbCom.Parameters.AddWithValue(\"@{0}\", {1});", s, propertyInfos[i].ToUpper()));
return lines;
case MethodType.None:
break;
default:
break;
}
i++;
}
return lines;
}
示例10: PipelineException
public PipelineException(PipelineErrorType errorType, string serviceName, string route, Uri requestUri, MethodType methodType, Exception innerException)
: base(PipelineException.DefaultMessage, innerException)
{
this.errorType = errorType;
this.serviceName = serviceName;
this.route = route;
this.requestUri = requestUri;
this.methodType = methodType;
}
示例11: CreateMethod
/// <summary>
/// Creates a service object method with the given name, description and Methodtype
/// </summary>
/// <param name="name"></param>
/// <param name="description"></param>
/// <param name="methodType"></param>
/// <returns></returns>
public static Method CreateMethod(string name, string description, MethodType methodType)
{
Method m = new Method();
m.Name = name;
m.Type = methodType;
m.MetaData.DisplayName = AddSpaceBeforeCaptialLetter(name);
m.MetaData.Description = description;
return m;
}
示例12: NativeInvokerBytecodeGenerator
private NativeInvokerBytecodeGenerator(LambdaForm lambdaForm, MethodType invokerType)
{
if (invokerType != invokerType.basicType())
{
throw new BailoutException(Bailout.NotBasicType, invokerType);
}
this.lambdaForm = lambdaForm;
this.invokerType = invokerType;
this.delegateType = MethodHandleUtil.GetMemberWrapperDelegateType(invokerType);
MethodInfo mi = MethodHandleUtil.GetDelegateInvokeMethod(delegateType);
Type[] paramTypes = MethodHandleUtil.GetParameterTypes(typeof(object[]), mi);
// HACK the code we generate is not verifiable (known issue: locals aren't typed correctly), so we stick the DynamicMethod into mscorlib (a security critical assembly)
this.dm = new DynamicMethod(lambdaForm.debugName, mi.ReturnType, paramTypes, typeof(object).Module, true);
this.ilgen = CodeEmitter.Create(this.dm);
if (invokerType.parameterCount() > MethodHandleUtil.MaxArity)
{
this.packedArgType = paramTypes[paramTypes.Length - 1];
this.packedArgPos = paramTypes.Length - 1;
}
else
{
this.packedArgPos = Int32.MaxValue;
}
locals = new CodeEmitterLocal[lambdaForm.names.Length];
for (int i = lambdaForm._arity(); i < lambdaForm.names.Length; i++)
{
Name name = lambdaForm.names[i];
if (name.index() != i)
{
throw new BailoutException(Bailout.PreconditionViolated, "name.index() != i");
}
switch (name.typeChar())
{
case 'L':
locals[i] = ilgen.DeclareLocal(Types.Object);
break;
case 'I':
locals[i] = ilgen.DeclareLocal(Types.Int32);
break;
case 'J':
locals[i] = ilgen.DeclareLocal(Types.Int64);
break;
case 'F':
locals[i] = ilgen.DeclareLocal(Types.Single);
break;
case 'D':
locals[i] = ilgen.DeclareLocal(Types.Double);
break;
case 'V':
break;
default:
throw new BailoutException(Bailout.PreconditionViolated, "Unsupported typeChar(): " + name.typeChar());
}
}
}
示例13: CreateMethod
/// <summary>
/// Creates a service object method with the given name, description and Methodtype
/// </summary>
/// <param name="name"></param>
/// <param name="description"></param>
/// <param name="methodType"></param>
/// <returns></returns>
public static Method CreateMethod(string name, string description, MethodType methodType)
{
Method m = new Method
{
Name = name,
Type = methodType,
MetaData = new MetaData(AddSpaceBeforeCaptialLetter(name), description)
};
return m;
}
示例14: Method
public Method(MethodType methodType, Endpoint endpoint, Action<IRequestMessage, IResponseMessage> action)
{
if (action == null)
{
throw new ArgumentNullException("action", "action cannot be null.");
}
this.Initialize(methodType, endpoint);
this.requestResponseAction = action;
}
示例15: FeedbackType
public FeedbackType(string name, int id, MethodInfo callback, MethodType methodType, List<FeedbackField> fields)
{
this.name = name;
this.id = id;
this.method = callback;
this.fields = fields;
methodHasTimestamp = (methodType & MethodType.Timestamp) != MethodType.None;
methodHasMsgType = (methodType & MethodType.MessageType) != MethodType.None;
methodIsObjectArray = (methodType & MethodType.ObjectArray) != MethodType.None;
}