本文整理汇总了C#中Operation类的典型用法代码示例。如果您正苦于以下问题:C# Operation类的具体用法?C# Operation怎么用?C# Operation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于命名空间,在下文中一共展示了Operation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
}
}
开发者ID:raymondlaghaeian,项目名称:LogicApp-BES,代码行数:27,代码来源:SwaggerConfig.cs
示例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"
});
}
}
开发者ID:Azure,项目名称:azure-mobile-apps-net-server,代码行数:32,代码来源:MobileAppHeaderFilter.cs
示例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);
}
开发者ID:StealFocus,项目名称:AzureExtensions,代码行数:28,代码来源:OperationTests.cs
示例4: GenerateMethodBody
private void GenerateMethodBody(DynamicMethod method, Operation operation)
{
ILGenerator generator = method.GetILGenerator();
generator.DeclareLocal(typeof(double));
GenerateMethodBody(generator, operation);
generator.Emit(OpCodes.Ret);
}
开发者ID:plurby,项目名称:Jace,代码行数:7,代码来源:DynamicCompiler.cs
示例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;
}
}
开发者ID:yeurch,项目名称:ServiceStack,代码行数:28,代码来源:ServiceMetadata.cs
示例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);
}
开发者ID:hoonzis,项目名称:PexMolesAndFakes,代码行数:32,代码来源:AccountService.cs
示例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");
}
}
开发者ID:frje,项目名称:SharpLang,代码行数:25,代码来源:SimpleIntegerArithmeticOverflow.cs
示例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);
}
开发者ID:BBSDeadEye,项目名称:ServiceStack,代码行数:29,代码来源:ServiceMetadata.cs
示例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;
}
开发者ID:yridesconix,项目名称:aws-sdk-net,代码行数:40,代码来源:GeneratorHelpers.cs
示例11: OnReset
public override void OnReset()
{
operation = Operation.Add;
integer1.Value = 0;
integer2.Value = 0;
storeResult.Value = 0;
}
开发者ID:HaoYunSun,项目名称:TEMPORAIRE,代码行数:7,代码来源:IntOperator.cs
示例12: OnReset
public override void OnReset()
{
operation = Operation.AND;
bool1.Value = false;
bool2.Value = false;
storeResult.Value = false;
}
开发者ID:TrojanFighter,项目名称:U3D-DesignerBehaviorTest1,代码行数:7,代码来源:BoolOperator.cs
示例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;
}
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:7,代码来源:AWSQueryValidator.cs
示例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);
}
开发者ID:Mithunchowdhury,项目名称:Erpoptima,代码行数:27,代码来源:DefectEntryController.cs
示例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);
}
开发者ID:hytcLiuhuaxu,项目名称:chat,代码行数:25,代码来源:Form1.cs
示例16: CreateHttpRequestMessage
private static HttpRequestMessage CreateHttpRequestMessage(HttpMethod httpMethod, Operation potentialOperation, SwaggerRoute potentialSwaggerRoute, HttpConfiguration httpConfig)
{
Contract.Requires(httpConfig != null);
Contract.Requires(potentialSwaggerRoute != null);
Contract.Ensures(Contract.Result<HttpRequestMessage>() != null);
Contract.Assume(potentialSwaggerRoute.ODataRoute.Constraints != null);
var oDataAbsoluteUri = potentialOperation.GenerateSampleODataUri(ServiceRoot, potentialSwaggerRoute.PrefixedTemplate);
var httpRequestMessage = new HttpRequestMessage(httpMethod, oDataAbsoluteUri);
var odataPath = GenerateSampleODataPath(potentialOperation, potentialSwaggerRoute);
var requestContext = new HttpRequestContext
{
Configuration = httpConfig
};
httpRequestMessage.SetConfiguration(httpConfig);
httpRequestMessage.SetRequestContext(requestContext);
var oDataRoute = potentialSwaggerRoute.ODataRoute;
var httpRequestMessageProperties = httpRequestMessage.ODataProperties();
Contract.Assume(httpRequestMessageProperties != null);
httpRequestMessageProperties.Model = oDataRoute.GetEdmModel();
httpRequestMessageProperties.Path = odataPath;
httpRequestMessageProperties.RouteName = oDataRoute.GetODataPathRouteConstraint().RouteName;
httpRequestMessageProperties.RoutingConventions = oDataRoute.GetODataPathRouteConstraint().RoutingConventions;
httpRequestMessageProperties.PathHandler = oDataRoute.GetODataPathRouteConstraint().PathHandler;
httpRequestMessage.SetRouteData(oDataRoute.GetRouteData("/", httpRequestMessage));
return httpRequestMessage;
}
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:31,代码来源:SwaggerRouteStrategy.cs
示例17: SubscriptionDataExtended
public SubscriptionDataExtended(Subscription subscription, SubscriptionData subscriptionData,
string description, Operation operation)
{
OperationDescription = description;
OperationStatus = operation.Status;
OperationId = operation.OperationTrackingId;
SubscriptionName = subscriptionData.SubscriptionName;
SubscriptionId = subscriptionData.SubscriptionId;
Certificate = subscriptionData.Certificate;
CurrentStorageAccount = subscriptionData.CurrentStorageAccount;
ServiceEndpoint = subscriptionData.ServiceEndpoint;
SqlAzureServiceEndpoint = subscriptionData.SqlAzureServiceEndpoint;
IsDefault = subscriptionData.IsDefault;
AccountAdminLiveEmailId = subscription.AccountAdminLiveEmailId;
CurrentCoreCount = subscription.CurrentCoreCount;
CurrentHostedServices = subscription.CurrentHostedServices;
CurrentStorageAccounts = subscription.CurrentStorageAccounts;
CurrentDnsServers = subscription.CurrentDnsServers;
CurrentLocalNetworkSites = subscription.CurrentLocalNetworkSites;
CurrentVirtualNetworkSites = subscription.CurrentVirtualNetworkSites;
MaxCoreCount = subscription.MaxCoreCount;
MaxHostedServices = subscription.MaxHostedServices;
MaxStorageAccounts = subscription.MaxStorageAccounts;
MaxDnsServers = subscription.MaxDnsServers;
MaxLocalNetworkSites = subscription.MaxLocalNetworkSites;
MaxVirtualNetworkSites = subscription.MaxVirtualNetworkSites;
ServiceAdminLiveEmailId = subscription.ServiceAdminLiveEmailId;
SubscriptionRealName = subscription.SubscriptionName;
SubscriptionStatus = subscription.SubscriptionStatus;
}
开发者ID:xmbms,项目名称:azure-sdk-tools,代码行数:30,代码来源:SubscriptionDataExtended.cs
示例18: PoItemApproved
public PoItemApproved()
{
var opJobs=new List<JobDescription>();
opJobs.Add(JobDescription.PurchasersManager);
opJobs.Add(JobDescription.Boss);
opJobs.Add(JobDescription.Admin);
var operation = new Operation
{
jobs=opJobs,
operationName="Cancel PO",
operationMethod=this.CancelPo
};
var opJobs1 = new List<JobDescription>();
opJobs1.Add(JobDescription.Purchaser);
opJobs1.Add(JobDescription.PurchasersManager);
opJobs1.Add(JobDescription.Boss);
opJobs1.Add(JobDescription.Admin);
var operation1 = new Operation
{
jobs = opJobs1,
operationName = "Waiting for Ship",
operationMethod = this.SetPoStateWatingForShip
};
operationList.Add(operation);
operationList.Add(operation1);
}
开发者ID:phox,项目名称:AmbleSystem,代码行数:31,代码来源:PoStates.cs
示例19: SaveCmnCurrency
public ActionResult SaveCmnCurrency(CmnCurrency currency)
{
Operation objOperation = new Operation { Success = false };
if (ModelState.IsValid)
{
int userId = Convert.ToInt32(Session["userId"].ToString());
currency.CreatedBy = userId;
if (currency.Id == 0)
{
if ((bool)Session["Add"])
{
objOperation = _ccService.SaveCmnCurrency(currency);
}
else { objOperation.OperationId = -1; }
}
else
{
if ((bool)Session["Edit"])
{
currency.ModifiedBy = userId;
objOperation = _ccService.UpdateCmnCurrency(currency);
}
else { objOperation.OperationId = -2; }
}
}
return Json(objOperation, JsonRequestBehavior.DenyGet);
}
开发者ID:Mithunchowdhury,项目名称:Erpoptima,代码行数:29,代码来源:CurrencyController.cs
示例20: CreateOperation
public int CreateOperation(Operation operation)
{
operation.Amount = operation.NumberOfShares * operation.Price + operation.Fees;
unitOfWork.OperationRepository.Insert(operation);
unitOfWork.Save();
return operation.OperationId;
}
开发者ID:Zygonie,项目名称:SuiviPortefeuille,代码行数:7,代码来源:OperationServices.cs
注:本文中的Operation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论