本文整理汇总了C#中Operation类的典型用法代码示例。如果您正苦于以下问题:C# Operation类的具体用法?C# Operation怎么用?C# Operation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于命名空间,在下文中一共展示了Operation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
{
List<SwaggerDefaultValue> listDefine = new List<SwaggerDefaultValue>
{
new SwaggerDefaultValue("Compare", "<", "<,<=,>,>=,="),
//new SwaggerDefaultValue("Model_URI", "@{body(\'besconnector').Results.output2.FullURL}"),
//new SwaggerDefaultValue("Evaluate_Output_Path", "@{body(\'besconnector\').Results.output1.FullURL}")
};
if (operation.parameters == null)
return;
foreach (var param in operation.parameters)
{
var actionParam = apiDescription.ActionDescriptor.GetParameters().First(p => p.ParameterName == param.name);
foreach (SwaggerDefaultValue customAttribute in listDefine)
{
if (customAttribute.ParameterName == param.name)
{
[email protected] = customAttribute.DefaultValue;
string[] listValue = customAttribute.Values.Split(',');
if (listValue != null && listValue.Length > 1)
[email protected] = listValue;
}
}
}
}
示例2: Apply
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
{
if (operation == null)
{
throw new ArgumentNullException("operation");
}
if (apiDescription == null)
{
throw new ArgumentNullException("apiDescription");
}
Collection<IFilter> filters = apiDescription.ActionDescriptor.ControllerDescriptor.GetFilters();
IEnumerable<IFilter> mobileAppFilter = filters.Where(f => typeof(MobileAppControllerAttribute).IsAssignableFrom(f.GetType()));
if (mobileAppFilter.Any())
{
if (operation.parameters == null)
{
operation.parameters = new List<Parameter>();
}
operation.parameters.Add(new Parameter
{
name = "ZUMO-API-VERSION",
@in = "header",
type = "string",
required = true,
@default = "2.0.0"
});
}
}
示例3: TestCheckStatus2
public void TestCheckStatus2()
{
Uri packageUrl = Blob.GetUrl("bzytasksweurosys", "mydeployments", "20111207_015202_Beazley.Tasks.Azure.cspkg");
IDeployment deployment = new Deployment();
string createRequestId = deployment.CreateRequest(
WindowsAzureAccount.SubscriptionId,
WindowsAzureAccount.CertificateThumbprint,
"BeazleyTasks-WEuro-Sys",
DeploymentSlot.Production,
"DeploymentName",
packageUrl,
"DeploymentLabel",
"ServiceConfiguration.Cloud-SysTest.cscfg",
true,
true);
IOperation operation = new Operation();
OperationResult operationResult1 = operation.StatusCheck(
WindowsAzureAccount.SubscriptionId,
WindowsAzureAccount.CertificateThumbprint,
createRequestId);
Assert.IsNotNull(operationResult1);
System.Threading.Thread.Sleep(5000);
OperationResult operationResult2 = operation.StatusCheck(
WindowsAzureAccount.SubscriptionId,
WindowsAzureAccount.CertificateThumbprint,
createRequestId);
Assert.IsNotNull(operationResult2);
}
示例4: GenerateMethodBody
private void GenerateMethodBody(DynamicMethod method, Operation operation)
{
ILGenerator generator = method.GetILGenerator();
generator.DeclareLocal(typeof(double));
GenerateMethodBody(generator, operation);
generator.Emit(OpCodes.Ret);
}
示例5: Add
public void Add(Type serviceType, Type requestType, Type responseType)
{
this.ServiceTypes.Add(serviceType);
this.RequestTypes.Add(requestType);
var restrictTo = requestType.GetCustomAttributes(true)
.OfType<RestrictAttribute>().FirstOrDefault()
?? serviceType.GetCustomAttributes(true)
.OfType<RestrictAttribute>().FirstOrDefault();
var operation = new Operation {
ServiceType = serviceType,
RequestType = requestType,
ResponseType = responseType,
RestrictTo = restrictTo,
Actions = GetImplementedActions(serviceType, requestType),
Routes = new List<RestPath>(),
};
this.OperationsMap[requestType] = operation;
this.OperationNamesMap[requestType.Name.ToLower()] = operation;
if (responseType != null)
{
this.ResponseTypes.Add(responseType);
this.OperationsResponseMap[responseType] = operation;
}
}
示例6: MakeTransfer
public void MakeTransfer(Account creditAccount, Account debitAccount, decimal amount)
{
if (creditAccount == null)
{
throw new AccountServiceException("creditAccount null");
}
if (debitAccount == null)
{
throw new AccountServiceException("debitAccount null");
}
if (debitAccount.Balance < amount && debitAccount.AutorizeOverdraft == false)
{
throw new AccountServiceException("not enough money");
}
Operation creditOperation = new Operation() { Amount = amount, Direction = Direction.Credit};
Operation debitOperation = new Operation() { Amount = amount, Direction = Direction.Debit };
creditAccount.Operations.Add(creditOperation);
debitAccount.Operations.Add(debitOperation);
creditAccount.Balance += amount;
debitAccount.Balance -= amount;
_operationRepository.CreateOperation(creditOperation);
_operationRepository.CreateOperation(debitOperation);
_accountRepository.UpdateAccount(creditAccount);
_accountRepository.UpdateAccount(debitAccount);
}
示例7: TestOverflow
static void TestOverflow(Operation op, uint a, uint b)
{
try
{
checked
{
switch (op)
{
case Operation.Add:
System.Console.WriteLine(a + b);
break;
case Operation.Sub:
System.Console.WriteLine(a - b);
break;
case Operation.Mul:
System.Console.WriteLine(a * b);
break;
}
}
}
catch (System.OverflowException)
{
System.Console.WriteLine("Overflow");
}
}
示例8: Apply
public void Apply(Operation operation, SchemaRegistry schemaRegistry, System.Web.Http.Description.ApiDescription apiDescription)
{
// stripping the name
string operationName = operation.operationId;
if (!string.IsNullOrEmpty(operationName))
{
// swashbuckle adds controller name, stripping that
int index = operationName.IndexOf("_", 0);
if (index >= 0 && (index + 1) < operationName.Length)
{
operation.operationId = operationName.Substring(index + 1);
}
}
// operation response change
IDictionary<string, Response> responses = operation.responses;
if (responses != null && !responses.ContainsKey(defaultResponseCode))
{
try
{
string successResponseCode = JsonSwaggerGenerator.GetReturnCodeForSuccess(responses.Keys);
Response successResponse = responses[successResponseCode];
Response defaultResponse = new Response();
defaultResponse.description = Resources.DefaultResponseDescription;
defaultResponse.schema = null;
responses.Add(defaultResponseCode, defaultResponse);
}
catch(InvalidOperationException)
{
throw new Exception("No success code found, not adding default response code");
}
}
}
开发者ID:sudarsanan-krishnan,项目名称:DynamicsCRMConnector,代码行数:35,代码来源:OperationNameAndDefaultResponseFilter.cs
示例9: Add
public void Add(Type serviceType, Type requestType, Type responseType)
{
this.ServiceTypes.Add(serviceType);
this.RequestTypes.Add(requestType);
var restrictTo = requestType.FirstAttribute<RestrictAttribute>()
?? serviceType.FirstAttribute<RestrictAttribute>();
var operation = new Operation {
ServiceType = serviceType,
RequestType = requestType,
ResponseType = responseType,
RestrictTo = restrictTo,
Actions = GetImplementedActions(serviceType, requestType),
Routes = new List<RestPath>(),
};
this.OperationsMap[requestType] = operation;
this.OperationNamesMap[operation.Name.ToLower()] = operation;
//this.OperationNamesMap[requestType.Name.ToLower()] = operation;
if (responseType != null)
{
this.ResponseTypes.Add(responseType);
this.OperationsResponseMap[responseType] = operation;
}
LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, OperationsMap.Count);
}
示例10: DetermineAWSQueryListMemberSuffix
/// <summary>
/// Inspects list member to determine if the original list shape in the model has been
/// substituted and if so, whether a member suffix should be used to extract the value
/// for use in the query. An example usage would be the replacement of IpRange (in EC2)
/// within an IpRangeList - we treat as a list of strings, yet need to get to the
/// IpRange.CidrIp member in the query marshalling. Note that we also have some EC2
/// operations where we don't want this submember extraction too even though the
/// same substitite is in use.
/// </summary>
/// <param name="member"></param>
/// <returns></returns>
public static string DetermineAWSQueryListMemberSuffix(Operation operation, Member member)
{
if (member.Shape.ModelListShape == null)
return null;
string suffixMember = null;
var substituteShapeData = member.model.Customizations.GetSubstituteShapeData(member.ModelShape.ModelListShape.Name);
if (substituteShapeData != null && substituteShapeData[CustomizationsModel.EmitFromMemberKey] != null)
{
var useSuffix = true;
if (substituteShapeData[CustomizationsModel.ListMemberSuffixExclusionsKey] != null)
{
var exclusions = substituteShapeData[CustomizationsModel.ListMemberSuffixExclusionsKey];
foreach (JsonData excl in exclusions)
{
if (string.Equals(operation.Name, (string)excl, StringComparison.Ordinal))
{
useSuffix = false;
break;
}
}
}
if (useSuffix)
suffixMember = (string)substituteShapeData[CustomizationsModel.EmitFromMemberKey];
}
return suffixMember;
}
示例11: OnReset
public override void OnReset()
{
operation = Operation.Add;
integer1.Value = 0;
integer2.Value = 0;
storeResult.Value = 0;
}
示例12: OnReset
public override void OnReset()
{
operation = Operation.AND;
bool1.Value = false;
bool2.Value = false;
storeResult.Value = false;
}
示例13: AWSQueryValidator
public AWSQueryValidator(IDictionary<string, string> paramters, object request, ServiceModel serviceModel, Operation operation)
{
this.Parameters = paramters;
this.Request = request;
this.Model = serviceModel;
this.Operation = operation;
}
示例14: Save
public ActionResult Save(SlsDefect slsDefect)
{
int companyId = Convert.ToInt32(Session["companyId"]);
int userId = Convert.ToInt32(Session["userId"]);
Operation objOperation = new Operation { Success = false };
if (ModelState.IsValid && slsDefect != null)
{
if (slsDefect.Id == 0)
{
if ((bool)Session["Add"])
{
slsDefect.SecCompanyId = companyId;
slsDefect.CreatedBy = userId;
slsDefect.CreatedDate = DateTime.Now;
//invDamage.InvDamageDetails = null;
objOperation = _IDefectEntryService.Save(slsDefect);
}
}
else
{
}
}
return Json(objOperation, JsonRequestBehavior.DenyGet);
}
示例15: frmMain_Load
private void frmMain_Load(object sender, EventArgs e)
{
IPAddress myip= Operation.getMyIP();
if (myip == null)
{
MessageBox.Show("sorry");
Application.Exit();
}
//开始侦听
frmMain.CheckForIllegalCrossThreadCalls = false;
Operation ope = new Operation(this);
Thread th = new Thread(new ThreadStart(ope.listen));
th.IsBackground = true;
th.Start();
Thread.Sleep(100);
//开始广播
UdpClient uc = new UdpClient();
txtName = this.txtNickName.Text;
string msg = "LOGIN|" + this.txtNickName.Text + "|12|小毛驴";
byte[] bmsg = Encoding.Default.GetBytes(msg);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 9527);
uc.Send(bmsg, bmsg.Length, ipep);
}