本文整理汇总了C#中IDataContext类的典型用法代码示例。如果您正苦于以下问题:C# IDataContext类的具体用法?C# IDataContext怎么用?C# IDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDataContext类属于命名空间,在下文中一共展示了IDataContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplicationApiController
protected ApplicationApiController(
IDataContext dataContext,
Func<int> getUserId)
{
this.DataContext = dataContext;
this.UserId = getUserId();
}
开发者ID:joshball,项目名称:my-walletz-angular,代码行数:7,代码来源:ApplicationApiController.cs
示例2: Execute
public void Execute(IDataContext context, DelegateExecute nextExecute)
{
var textControl = context.GetData(DataConstants.TEXT_CONTROL);
GC.KeepAlive(textControl);
DateTime lastInvocation, utcNow = DateTime.UtcNow;
lock (syncLock)
{
lastInvocation = this.lastLocateInvocation;
this.lastLocateInvocation = utcNow;
}
const int doubleKeyPressDelay = 500;
if (utcNow.Subtract(lastInvocation).TotalMilliseconds < doubleKeyPressDelay)
{
var locateFileAction = actionManager.TryGetAction(LocateFileAction.Id) as IExecutableAction;
if (locateFileAction != null)
{
locateFileAction.Execute(context);
return;
}
}
if (lastUnderlyingActionUpdate)
{
nextExecute();
}
}
开发者ID:hmemcpy,项目名称:ReSharper.LocateFileInSolutionExplorer,代码行数:28,代码来源:LocateFileActionHandler.cs
示例3: SetErrors
/// <summary>
/// Sets errors for binding target.
/// </summary>
/// <param name="target">The binding target object.</param>
/// <param name="errors">The collection of errors</param>
/// <param name="context">The specified context, if any.</param>
protected override sealed void SetErrors(object target, IList<object> errors, IDataContext context)
{
base.SetErrors(target, errors, context);
var control = target as Control;
if (control == null)
return;
Control rootControl = PlatformExtensions.GetRootControl(control);
if (rootControl == null)
return;
ErrorProvider errorProvider = GetErrorProviderInternal(rootControl);
if (errorProvider == null)
return;
var oldProvider = ServiceProvider
.AttachedValueProvider
.GetValue<ErrorProvider>(target, ErrorProviderName, false);
if (!ReferenceEquals(oldProvider, errorProvider))
{
if (oldProvider != null)
{
oldProvider.SetError(control, null);
TryDispose(oldProvider);
}
ServiceProvider.AttachedValueProvider.SetValue(control, ErrorProviderName, errorProvider);
if (errorProvider.Tag == null)
errorProvider.Tag = 1;
else if (errorProvider.Tag is int)
errorProvider.Tag = (int)errorProvider.Tag + 1;
}
SetErrors(control, errorProvider, errors, context);
}
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:37,代码来源:BindingErrorProvider.cs
示例4: Handle
public void Handle(ref string bindingExpression, IDataContext context)
{
foreach (var replaceKeyword in ReplaceKeywords)
bindingExpression = bindingExpression.Replace(replaceKeyword.Key, replaceKeyword.Value);
if (!bindingExpression.Contains("$\"") && !bindingExpression.Contains("$'"))
return;
Dictionary<string, string> dict = null;
InterpolatedStringTokenizer.SetSource(bindingExpression);
while (InterpolatedStringTokenizer.Token != TokenType.Eof)
{
int start;
int end;
var exp = ParseInterpolatedString(InterpolatedStringTokenizer, out start, out end);
if (exp != null)
{
if (dict == null)
dict = new Dictionary<string, string>();
dict[bindingExpression.Substring(start, end - start)] = exp;
}
}
if (dict != null)
{
foreach (var s in dict)
{
if (s.Value != null)
bindingExpression = bindingExpression.Replace(s.Key, s.Value);
}
}
}
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:30,代码来源:DefaultBindingParserHandler.cs
示例5: Compose
private void Compose(IDataContext value)
{
foreach(var child in transform)
{
var go = ((Transform)child).gameObject;
go.SetActive(false);
}
_composedDataContext = value;
if(value != null)
{
var name = value.GetType().Name;
foreach(var child in transform)
{
var go = ((Transform)child).gameObject;
if (go.name != name)
continue;
go.SetActive(true);
break;
}
}
BroadcastDataContextChange(_composedDataContext);
}
开发者ID:GeorgeR,项目名称:UnityDatabinding,代码行数:28,代码来源:CompositionBinder.cs
示例6: UnitOfWork
public UnitOfWork(IDataContext dataContext, IUnitOfWorkManager manager)
{
State = UnitOfWorkState.Active;
DataContext = dataContext;
Manager = manager;
Manager.Add(this);
}
开发者ID:scrato,项目名称:RPA-RO_Business_Logic,代码行数:7,代码来源:UnitOfWork.cs
示例7: Update
/// <summary>
/// Updates the property value.
/// </summary>
/// <param name="dataContext">
/// The data context.
/// </param>
/// <param name="target">
/// The target.
/// </param>
public void Update(IDataContext dataContext, object target)
{
if (target == null)
throw new ArgumentNullException("target");
Property.SetValue(target, ValueCalculator.GetValue(dataContext));
}
开发者ID:mparsin,项目名称:Elements,代码行数:16,代码来源:PropertySetter.cs
示例8: IsAvailable
public override bool IsAvailable(IDataContext context)
{
IList<ITypeMember> typeMembers;
ITypeElement ownerType;
var moveStaticMembersIsAvailable = IsAvailable(context, out typeMembers, out ownerType);
if (!moveStaticMembersIsAvailable) return false;
Methods = new List<IMethod>();
foreach (var typeMember in typeMembers) {
var method = typeMember != null ? typeMember as IMethod : null;
if (method == null) return false;
// Do a quick check to see if Extension Methods are allowed.
var methodDeclaration = method.GetDeclarations().FirstOrDefault();
if (methodDeclaration != null) {
var treeNode = methodDeclaration.CreateTreeElementPointer().GetTreeNode();
if (treeNode != null && !treeNode.IsVB9Supported()) return false;
}
if (!method.IsStatic || method.Parameters.None() || method.Parameters.First().Kind != ParameterKind.VALUE) return false;
if (method.IsExtensionMethod ^ Direction == WorkflowDirection.ExtensionToShared) return false;
Methods.Add(method);
}
return true;
}
开发者ID:ThatShawGuy,项目名称:VBSharper,代码行数:27,代码来源:SharedToExtensionWorkflow.cs
示例9: GetOriginTypeElement
private static ITypeElement GetOriginTypeElement(IDataContext dataContext, DeclaredElementTypeUsageInfo initialTarget)
{
var data = dataContext.GetData(DataConstants.REFERENCES);
if (data == null) {
return null;
}
foreach (var current in data.OfType<IQualifiableReference>()) {
if (!Equals(current.Resolve().DeclaredElement, initialTarget)) {
continue;
}
var qualifierWithTypeElement = current.GetQualifier() as IQualifierWithTypeElement;
if (qualifierWithTypeElement == null) {
continue;
}
var qualifierTypeElement = qualifierWithTypeElement.GetQualifierTypeElement();
if (qualifierTypeElement != null) {
return qualifierTypeElement;
}
}
return null;
}
开发者ID:jcdekoning,项目名称:Teapot,代码行数:25,代码来源:GenericImplementationContextSearch.cs
示例10: GetModel
public static EngineCodeMappingViewModel GetModel(IDataContext context)
{
return new EngineCodeMappingViewModel()
{
Configuration = context.ConfigurationSettings
};
}
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:7,代码来源:EngineCodeMappingViewModel.cs
示例11: IsAvailable
// Hides the menu item if it's not a Unity project
public override bool IsAvailable(IDataContext dataContext)
{
var project = dataContext.GetData(ProjectModelDataConstants.PROJECT);
if (project == null || !project.IsUnityProject())
return false;
return base.IsAvailable(dataContext);
}
开发者ID:JetBrains,项目名称:resharper-unity,代码行数:8,代码来源:GenerateUnityEventFunctionsWorkflow.cs
示例12: MarketMappingViewModel
private static async Task<MarketMappingViewModel> GetFullAndPartialViewModelForMarketMapping
(
IDataContext context,
MarketMappingFilter filter
)
{
var baseModel = SharedModelBase.GetBaseModel(context);
var model = new MarketMappingViewModel()
{
PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
Configuration = context.ConfigurationSettings,
CurrentUser = baseModel.CurrentUser,
CurrentVersion = baseModel.CurrentVersion
};
var marketMapping = await context.Market.GetFdpMarketMapping(filter);
var programmeFilter = new ProgrammeFilter()
{
ProgrammeId = marketMapping.ProgrammeId,
Gateway = marketMapping.Gateway,
Code = model.MarketMapping.Programme.VehicleName // In order to filter the gateways specific to the programme
};
HydrateModelWithCommonProperties(model, context, programmeFilter);
model.Gateways = context.Vehicle.ListGateways(programmeFilter);
if (!(marketMapping is EmptyFdpMarketMapping))
{
marketMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == marketMapping.ProgrammeId.GetValueOrDefault());
}
model.MarketMapping = marketMapping;
return model;
}
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:33,代码来源:MarketMappingViewModel.cs
示例13: GenerateContent
protected override string GenerateContent(IDataContext context, string outputFolder)
{
var bound = context.GetComponent<ISettingsStore>().BindToContextTransient(ContextRange.ApplicationWide);
foreach (TemplateApplicability applicability in Enum.GetValues(typeof(TemplateApplicability)))
CreateXml(applicability, bound, outputFolder, GeneralHelpers.GetCurrentVersion(), context);
return "Code templates";
}
开发者ID:dmimat,项目名称:RsDocGenerator,代码行数:7,代码来源:RsDocExportTemplates.cs
示例14: GetSessionId
private static string GetSessionId(IDataContext context)
{
UnitTestSession session = GetUnitTestSession(context);
if (session == null)
return null;
#if ! RESHARPER_50_OR_NEWER || RESHARPER_60_OR_NEWER
return session.ID;
#else
// HACK: Get the last RunId for correlation instead of the SessionId because the SessionId is
// not available to the task runner in R# 5.0 but the RunId is, so we use that for correlation.
// Unfortunately runs are transient so they are deleted after tests finish. However before that
// happens, the Update method will be called many times to update UI state so we should be able
// to catch the run in flight and save it for later.
//
// I have asked JetBrains to provide SessionId info to TaskRunners in a future release
// as it was done in R# 3.1. -- Jeff.
foreach (IUnitTestRun run in session.Runs)
{
string runId = run.ID;
LastRunIdCache[session.ID] = runId;
return runId;
}
string lastRunId;
LastRunIdCache.TryGetValue(session.ID, out lastRunId);
return lastRunId;
#endif
}
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:29,代码来源:ShowReportAction.cs
示例15: IsAvailable
public bool IsAvailable(IDataContext dataContext)
{
// todo make this resolvable also via the AllTypes... line
var invokedNode = dataContext.GetSelectedTreeNode<IExpression>();
return cachedRegistrations.Any(r => r.Registration.RegistrationElement.Children().Contains(invokedNode));
}
开发者ID:renana,项目名称:AgentMulder,代码行数:7,代码来源:RegisteredComponentsContextSearch.cs
示例16: Execute
/// <summary>Executes action. Called after Update, that set ActionPresentation.Enabled to true.</summary>
/// <param name="context">The data context.</param>
/// <param name="nextExecute">delegate to call</param>
public void Execute(IDataContext context, [CanBeNull] DelegateExecute nextExecute)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
if (!AtLeadInWhitespace(context))
{
if (nextExecute != null)
{
nextExecute();
}
return;
}
var service = Shell.Instance.GetComponent<AutoTemplatesService>();
var settings = service.GetSettings();
if (!settings.GetUseCompleteStatement())
{
return;
}
var actionManager = Shell.Instance.GetComponent<ActionManager>();
var action = actionManager.TryGetAction("Generate") as IExecutableAction;
if (action != null)
{
action.Execute(context);
}
}
开发者ID:JakobChristensen,项目名称:Resharper.PredictiveCodeSuggestions,代码行数:34,代码来源:CompleteStatementContextAction.cs
示例17: Persist
public static IEnumerable<ValidationResult> Persist(IDataContext context,
TakeRateFilter filter,
FluentValidation.Results.ValidationResult results,
bool global)
{
return context.TakeRate.PersistValidationErrors(filter, results, global);
}
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:7,代码来源:Validator.cs
示例18: Execute
/// <summary>
/// Executes action. Called after Update, that set <c>ActionPresentation.Enabled</c> to true.
/// </summary>
/// <param name="solution">The solution.</param>
/// <param name="context">The context.</param>
protected override void Execute(ISolution solution, IDataContext context)
{
if (!context.CheckAllNotNull(DataConstants.SOLUTION)) {
return;
}
ITextControl textControl = context.GetData(DataConstants.TEXT_CONTROL);
if (textControl == null) {
return;
}
IElement element = GetElementAtCaret(context);
if (element == null) {
return;
}
var enumDeclaration = element.ToTreeNode().Parent as IEnumDeclaration;
if (enumDeclaration == null) {
return;
}
using (ModificationCookie cookie = textControl.Document.EnsureWritable()) {
if (cookie.EnsureWritableResult != EnsureWritableResult.SUCCESS) {
return;
}
using (CommandCookie.Create("Context Action Sort Enum By Name")) {
PsiManager.GetInstance(solution).DoTransaction(delegate { Execute(solution, enumDeclaration); });
}
}
}
开发者ID:tcabanski,项目名称:SouthSideDevToys,代码行数:36,代码来源:SortEnumByNameActionHandler.cs
示例19: Execute
public void Execute(IDataContext context, DelegateExecute nextExecute)
{
var injector = PlatformObsoleteStatics.Instance.GetComponent<FileInjectedLayers>();
if (injector == null)
{
throw new ApplicationException("Could not get FileInjectedLayers instance!");
}
var file = new FileSystemPath(SettingsFilePath);
var settingsLayers = PlatformObsoleteStatics.Instance.GetComponent<UserInjectedSettingsLayers>();
if (settingsLayers == null)
{
throw new ApplicationException("Could not get UserInjectedSettingsLayers instance!");
}
var layers = settingsLayers.GetUserInjectedLayersFromHost(_globalSettings.ProductGlobalLayerId);
foreach (var layer in layers)
{
// TODO: find out if there's an easier way to check if this is layer we want, e.g. by id
settingsLayers.TurnInjectedLayerOnOff(layer.Id, layer.Name == LayerName);
}
if (!injector.IsLayerInjected(_globalSettings.ProductGlobalLayerId, file))
{
injector.InjectLayer(_globalSettings.ProductGlobalLayerId, file);
}
}
开发者ID:dineshkummarc,项目名称:FastSettingsSwitch,代码行数:28,代码来源:SwitchSettingsAction.cs
示例20: RecalculatePoints
public void RecalculatePoints(IDataContext dataContext, IPointsCalculator pointsCalculator, List<PlayedGameToRecalculate> playedGamesToRecalculate)
{
int counter = 0;
foreach (var playedGame in playedGamesToRecalculate)
{
var playerRanks = playedGame.PlayerGameResults.Select(x => new PlayerRank
{
PlayerId = x.PlayerId,
GameRank = x.GameRank
}).ToList();
var newPoints = pointsCalculator.CalculatePoints(playerRanks, playedGame.BoardGameGeekGameDefinition);
var applicationUserForThisGamingGroup = new ApplicationUser()
{
CurrentGamingGroupId = playedGame.GamingGroupId
};
foreach (var playerGameResult in playedGame.PlayerGameResults)
{
var scorecard = newPoints[playerGameResult.PlayerId];
playerGameResult.NemeStatsPointsAwarded = scorecard.BasePoints;
playerGameResult.GameDurationBonusPoints = scorecard.GameDurationBonusPoints;
playerGameResult.GameWeightBonusPoints = scorecard.GameWeightBonusPoints;
dataContext.Save(playerGameResult, applicationUserForThisGamingGroup);
}
Debug.WriteLine("{0} games updated... last PlayedGame.Id is {1}", ++counter, playedGame.PlayedGameId);
}
}
开发者ID:NemeStats,项目名称:NemeStats,代码行数:30,代码来源:GlobalPointsRecalculator.cs
注:本文中的IDataContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论