本文整理汇总了C#中ResolutionContext类的典型用法代码示例。如果您正苦于以下问题:C# ResolutionContext类的具体用法?C# ResolutionContext怎么用?C# ResolutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolutionContext类属于命名空间,在下文中一共展示了ResolutionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExecuteCommand
public async override Task ExecuteCommand()
{
CalculateEffectivePackageSaveMode();
string installPath = ResolveInstallPath();
var packageSourceProvider = new NuGet.Configuration.PackageSourceProvider(Settings);
var sourceRepositoryProvider = new SourceRepositoryProvider(packageSourceProvider, ResourceProviders);
IEnumerable<SourceRepository> primarySources;
IEnumerable<SourceRepository> secondarySources;
GetEffectiveSources(sourceRepositoryProvider, out primarySources, out secondarySources);
if(Arguments.Count == 0)
{
throw new InvalidOperationException(NuGetResources.InstallCommandPackageIdMustBeProvided);
}
string packageId = Arguments[0];
NuGetPackageManager packageManager = new NuGetPackageManager(sourceRepositoryProvider, installPath);
ResolutionContext resolutionContext = new ResolutionContext(dependencyBehavior: DependencyBehavior, includePrelease: Prerelease);
FolderNuGetProject nugetProject = new FolderNuGetProject(installPath);
nugetProject.PackageSaveMode = EffectivePackageSaveMode;
if (Version == null)
{
await packageManager.InstallPackageAsync(nugetProject, packageId, resolutionContext, new Common.Console(),
primarySources, secondarySources, CancellationToken.None);
}
else
{
await packageManager.InstallPackageAsync(nugetProject, new PackageIdentity(packageId, new NuGetVersion(Version)), resolutionContext,
new Common.Console(), primarySources, secondarySources, CancellationToken.None);
}
}
开发者ID:jugglingnutcase,项目名称:NuGet.CommandLine,代码行数:33,代码来源:InstallCommand.cs
示例2: EnumChildren
public static void EnumChildren(ICompletionDataGenerator cdgen,ResolutionContext ctxt, UserDefinedType udt, bool isVarInstance,
MemberFilter vis = MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables | MemberFilter.Enums)
{
var scan = new MemberCompletionEnumeration(ctxt, cdgen) { isVarInst = isVarInstance };
scan.DeepScanClass(udt, vis);
}
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:MemberCompletionEnumeration.cs
示例3: Evaluation
Evaluation(AbstractSymbolValueProvider vp) {
this.ValueProvider = vp;
if(vp!=null)
vp.ev = this;
this.eval = true;
this.ctxt = vp.ResolutionContext;
}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:7,代码来源:Evaluation.cs
示例4: ResolutionResult
private ResolutionResult(object value, ResolutionContext context, Type memberType)
{
Value = value;
Context = context;
Type = ResolveType(value, memberType);
MemberType = memberType;
}
开发者ID:mwpowellhtx,项目名称:MicroMapper,代码行数:7,代码来源:ResolutionResult.cs
示例5: IsMatch
public bool IsMatch(ResolutionContext context)
{
return context.DestinationType.IsAssignableFrom(context.SourceType)
&& context.DestinationType.IsArray
&& context.SourceType.IsArray
&& !ElementsExplicitlyMapped(context);
}
开发者ID:DeanMilojevic,项目名称:AutoMapper,代码行数:7,代码来源:AssignableArrayMapper.cs
示例6: UFCSResolver
UFCSResolver(ResolutionContext ctxt, ISemantic firstArg, int nameHash = 0, ISyntaxRegion sr = null)
: base(ctxt)
{
this.firstArgument = firstArg;
this.nameFilterHash = nameHash;
this.sr = sr;
}
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:UFCSResolver.cs
示例7: Convert
public object Convert(Type enumSourceType, Type enumDestinationType, ResolutionContext context)
{
Type underlyingSourceType = Enum.GetUnderlyingType(enumSourceType);
var underlyingSourceValue = System.Convert.ChangeType(context.SourceValue, underlyingSourceType);
return Enum.ToObject(context.DestinationType, underlyingSourceValue);
}
开发者ID:DeanMilojevic,项目名称:AutoMapper,代码行数:7,代码来源:EnumNameValueMapperFactory.cs
示例8: GetStringType
public static ArrayType GetStringType(ResolutionContext ctxt, LiteralSubformat fmt = LiteralSubformat.Utf8)
{
ArrayType _t = null;
if (ctxt != null && ctxt.ScopedBlock != null)
{
var obj = ctxt.ParseCache.LookupModuleName(ctxt.ScopedBlock.NodeRoot as DModule, "object").FirstOrDefault();
if (obj != null)
{
string strType = fmt == LiteralSubformat.Utf32 ? "dstring" :
fmt == LiteralSubformat.Utf16 ? "wstring" :
"string";
var strNode = obj[strType];
if (strNode != null)
foreach (var n in strNode) {
_t = TypeDeclarationResolver.HandleNodeMatch(n, ctxt) as ArrayType;
if (_t != null)
break;
}
}
}
if (_t == null)
{
var ch = fmt == LiteralSubformat.Utf32 ? DTokens.Dchar :
fmt == LiteralSubformat.Utf16 ? DTokens.Wchar : DTokens.Char;
_t = new ArrayType(new PrimitiveType(ch, DTokens.Immutable));
}
return _t;
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:35,代码来源:Evaluation.PrimaryExpression.cs
示例9: SearchForClassDerivatives
public static IEnumerable<TemplateIntermediateType> SearchForClassDerivatives(TemplateIntermediateType t, ResolutionContext ctxt)
{
if (!(t is ClassType || t is InterfaceType))
throw new ArgumentException ("t is expected to be a class or an interface, not " + (t != null ? t.ToString () : "null"));
var f = new ClassInterfaceDerivativeFinder (ctxt);
f.typeNodeToFind = t.Definition;
var bt = t;
while (bt != null) {
f.alreadyResolvedClasses.Add (bt.Definition);
bt = DResolver.StripMemberSymbols (bt.Base) as TemplateIntermediateType;
}
var filter = MemberFilter.Classes;
if (t is InterfaceType) // -> Only interfaces can inherit interfaces. Interfaces cannot be subclasses of classes.
{
filter |= MemberFilter.Interfaces;
f.isInterface = true;
}
f.IterateThroughScopeLayers (t.Definition.Location, filter);
return f.results; // return them.
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:25,代码来源:ClassInterfaceDerivativeFinder.cs
示例10: ResolutionResult
private ResolutionResult(object value, ResolutionContext context)
{
_value = value;
_context = context;
_type = ResolveType(value, typeof(object));
_memberType = _type;
}
开发者ID:sclcwwl,项目名称:Gimela,代码行数:7,代码来源:ResolutionResult.cs
示例11: GetDoneVersionDebugSpecs
static void GetDoneVersionDebugSpecs(ConditionSet cs, MutableConditionFlagSet l, DBlockNode m, ResolutionContext ctxt)
{
if (m.StaticStatements == null || m.StaticStatements.Count == 0)
return;
foreach(var ss in m.StaticStatements)
{
if(ss is VersionSpecification)
{
var vs = (VersionSpecification)ss;
if(!_checkForMatchinSpecConditions(m,cs,ss,ctxt))
continue;
if(vs.SpecifiedId==null)
l.AddVersionCondition(vs.SpecifiedNumber);
else
l.AddVersionCondition(vs.SpecifiedId);
}
else if(ss is DebugSpecification)
{
var ds = (DebugSpecification)ss;
if(!_checkForMatchinSpecConditions(m,cs,ss, ctxt))
continue;
if (ds.SpecifiedId == null)
l.AddDebugCondition(ds.SpecifiedDebugLevel);
else
l.AddDebugCondition(ds.SpecifiedId);
}
}
}
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:33,代码来源:ConditionalCompilation.cs
示例12: InstallPackageByIdentityAsync
/// <summary>
/// Install package by Identity
/// </summary>
/// <param name="project"></param>
/// <param name="identity"></param>
/// <param name="resolutionContext"></param>
/// <param name="projectContext"></param>
/// <param name="isPreview"></param>
/// <param name="isForce"></param>
/// <param name="uninstallContext"></param>
/// <returns></returns>
protected async Task InstallPackageByIdentityAsync(NuGetProject project, PackageIdentity identity, ResolutionContext resolutionContext, INuGetProjectContext projectContext, bool isPreview, bool isForce = false, UninstallationContext uninstallContext = null)
{
List<NuGetProjectAction> actions = new List<NuGetProjectAction>();
// For Install-Package -Force
if (isForce)
{
PackageReference installedReference = project.GetInstalledPackagesAsync(CancellationToken.None).Result.Where(p =>
StringComparer.OrdinalIgnoreCase.Equals(identity.Id, p.PackageIdentity.Id)).FirstOrDefault();
if (installedReference != null)
{
actions.AddRange(await PackageManager.PreviewUninstallPackageAsync(project, installedReference.PackageIdentity, uninstallContext, projectContext, CancellationToken.None));
}
NuGetProjectAction installAction = NuGetProjectAction.CreateInstallProjectAction(identity, ActiveSourceRepository);
actions.Add(installAction);
}
else
{
actions.AddRange(await PackageManager.PreviewInstallPackageAsync(project, identity, resolutionContext, projectContext, ActiveSourceRepository, null, CancellationToken.None));
}
if (isPreview)
{
PreviewNuGetPackageActions(actions);
}
else
{
await PackageManager.ExecuteNuGetProjectActionsAsync(project, actions, this, CancellationToken.None);
}
}
开发者ID:mauroa,项目名称:NuGet.VisualStudioExtension,代码行数:40,代码来源:PackageActionBaseCommand.cs
示例13: IsMatch
public bool IsMatch(ResolutionContext context)
{
if (context == null) throw new ArgumentNullException("context");
bool toEnum = false;
return EnumToStringMapping(context, ref toEnum) || EnumToEnumMapping(context) || EnumToUnderlyingTypeMapping(context, ref toEnum);
}
开发者ID:firestrand,项目名称:AutoMapper,代码行数:7,代码来源:EnumMapper.cs
示例14: Scan
/// <summary>
/// </summary>
/// <param name="ast">The syntax tree to scan</param>
/// <param name="symbol">Might not be a child symbol of ast</param>
/// <param name="ctxt">The context required to search for symbols</param>
/// <returns></returns>
public static IEnumerable<ISyntaxRegion> Scan(DModule ast, INode symbol, ResolutionContext ctxt, bool includeDefinition = true)
{
if (ast == null || symbol == null || ctxt == null)
return null;
var f = new ReferencesFinder(symbol, ast, ctxt);
using(ctxt.Push(ast))
ast.Accept (f);
var nodeRoot = symbol.NodeRoot as DModule;
if (includeDefinition && nodeRoot != null && nodeRoot.FileName == ast.FileName)
{
var dc = symbol.Parent as DClassLike;
if (dc != null && dc.ClassType == D_Parser.Parser.DTokens.Template &&
dc.NameHash == symbol.NameHash)
{
f.l.Insert(0, new IdentifierDeclaration(dc.NameHash)
{
Location = dc.NameLocation,
EndLocation = new CodeLocation(dc.NameLocation.Column + dc.Name.Length, dc.NameLocation.Line)
});
}
f.l.Insert(0, new IdentifierDeclaration(symbol.NameHash)
{
Location = symbol.NameLocation,
EndLocation = new CodeLocation(symbol.NameLocation.Column + symbol.Name.Length, symbol.NameLocation.Line)
});
}
return f.l;
}
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:39,代码来源:ReferencesFinder.cs
示例15: IsMatch
public bool IsMatch(ResolutionContext context)
{
return typeof (LambdaExpression).IsAssignableFrom(context.SourceType)
&& context.SourceType != typeof (LambdaExpression)
&& typeof (LambdaExpression).IsAssignableFrom(context.DestinationType)
&& context.DestinationType != typeof (LambdaExpression);
}
开发者ID:AnatolyKulakov,项目名称:AutoMapper,代码行数:7,代码来源:ExpressionMapper.cs
示例16: ContextFrame
public ContextFrame(ResolutionContext ctxt, IBlockNode b, IStatement stmt = null)
{
this.ctxt = ctxt;
declarationCondititons = new ConditionalCompilation.ConditionSet(ctxt.CompilationEnvironment);
Set(b,stmt);
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:7,代码来源:ContextFrame.cs
示例17: Map
public object Map(ResolutionContext context, IMappingEngineRunner mapper)
{
var sourceDelegateType = context.SourceType.GetGenericArguments()[0];
var destDelegateType = context.DestinationType.GetGenericArguments()[0];
var expression = (LambdaExpression) context.SourceValue;
if (sourceDelegateType.GetGenericTypeDefinition() != destDelegateType.GetGenericTypeDefinition())
throw new AutoMapperMappingException("Source and destination expressions must be of the same type.");
var parameters = expression.Parameters.ToArray();
var body = expression.Body;
for (int i = 0; i < expression.Parameters.Count; i++)
{
var sourceParamType = sourceDelegateType.GetGenericArguments()[i];
var destParamType = destDelegateType.GetGenericArguments()[i];
if (sourceParamType == destParamType)
continue;
var typeMap = mapper.ConfigurationProvider.ResolveTypeMap(destParamType, sourceParamType);
if (typeMap == null)
throw new AutoMapperMappingException(
$"Could not find type map from destination type {destParamType} to source type {sourceParamType}. Use CreateMap to create a map from the source to destination types.");
var oldParam = expression.Parameters[i];
var newParam = Expression.Parameter(typeMap.SourceType, oldParam.Name);
parameters[i] = newParam;
var visitor = new MappingVisitor(typeMap, oldParam, newParam);
body = visitor.Visit(body);
}
return Expression.Lambda(body, parameters);
}
开发者ID:AnatolyKulakov,项目名称:AutoMapper,代码行数:34,代码来源:ExpressionMapper.cs
示例18: IsMatch
public bool IsMatch(ResolutionContext context)
{
return IsPrimitiveArrayType(context.DestinationType) &&
IsPrimitiveArrayType(context.SourceType) &&
(TypeHelper.GetElementType(context.DestinationType)
.Equals(TypeHelper.GetElementType(context.SourceType)));
}
开发者ID:DeanMilojevic,项目名称:AutoMapper,代码行数:7,代码来源:PrimitiveArrayMapper.cs
示例19: ActivateInstance
/// <summary>
/// Activates an instance with given arguments.
/// </summary>
/// <param name="resolutionContext">The container.</param>
/// <returns>The activated instance.</returns>
public object ActivateInstance(ResolutionContext resolutionContext)
{
var runtimeArguments = resolutionContext.RuntimeArguments;
if (this._container == null)
{
this._container = resolutionContext.Container;
}
int countOfRuntimeArguments = runtimeArguments.CountOfAllArguments;
if (this._cachedConstructor == null || countOfRuntimeArguments > 0)
{
var constructors = _implementationType.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
_cachedConstructor = this._constructorSelector.SelectConstructor(constructors, resolutionContext);
}
if (this._cachedArguments == null || countOfRuntimeArguments > 0 || GetAnyDependencyParameter(resolutionContext))
{
this._cachedArguments = this._argumentCollector.CollectArguments(
this._container.Resolve,
this._cachedConstructor.GetParameters(),
resolutionContext);
}
if (this._cachedArguments.Length != this._cachedConstructor.GetParameters().Length)
{
throw new ResolutionFailedException(
Resources.NoSuitableConstructorFoundFormat.FormatWith(_implementationType));
}
return this._cachedConstructor.Invoke(this._cachedArguments);
}
开发者ID:AlexZeitler,项目名称:LightCore,代码行数:38,代码来源:ReflectionActivator.cs
示例20: EnumToEnumMapping
private static bool EnumToEnumMapping(ResolutionContext context)
{
// Enum to enum mapping
var sourceEnumType = TypeHelper.GetEnumerationType(context.SourceType);
var destEnumType = TypeHelper.GetEnumerationType(context.DestinationType);
return sourceEnumType != null && destEnumType != null;
}
开发者ID:djbakasan,项目名称:AutoMapper,代码行数:7,代码来源:EnumMapper.cs
注:本文中的ResolutionContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论