本文整理汇总了C#中Context.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetObject方法的具体用法?C# Context.GetObject怎么用?C# Context.GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context.GetObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValuesOnDefaulAndConcurrentCtxObjs
public void SetValuesOnDefaulAndConcurrentCtxObjs()
{
Logger logger = new Logger();
BizUnit bizUnit =
new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");
Context ctx = new Context(bizUnit, logger);
ctx.Add("Ctx1-Val1", 1);
Logger concurrentLogger = new Logger();
Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger);
ctxConcurrent.Add("Ctx2-Val1", 24);
ctx.Add("Ctx1-Val2", 2);
ctxConcurrent.Add("Ctx2-Val2", 25);
Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 1);
Assert.AreEqual((int)ctx.GetObject("Ctx1-Val2"), 2);
Assert.AreEqual((int)ctx.GetObject("Ctx2-Val1"), 24);
Assert.AreEqual((int)ctx.GetObject("Ctx2-Val2"), 25);
Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 1);
Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val2"), 2);
Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val1"), 24);
Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val2"), 25);
}
示例2: NullValueStatusTest
public void NullValueStatusTest()
{
using (IContext context = new Context(@"C:\Project\ComponaSite\Compona.Web.SiteServiceLayer\bin\Debug\DM.npersist"))
{
Compona.Web.SiteDM.User user = (Compona.Web.SiteDM.User)context.GetObject(730,typeof(Compona.Web.SiteDM.User));
Assert.IsFalse(context.GetNullValueStatus(user,"Email") ) ;
}
}
示例3: GetPropertyValue
public object GetPropertyValue(Context ctx)
{
if(null != ctx)
{
return ctx.GetObject(Name);
}
return null;
}
示例4: ReplaceValueOnConcurrentCtxObjs
public void ReplaceValueOnConcurrentCtxObjs()
{
Logger logger = new Logger();
BizUnit bizUnit =
new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml");
Context ctx = new Context(bizUnit, logger);
ctx.Add("Ctx1-Val1", 1);
Logger concurrentLogger = new Logger();
Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger);
ctxConcurrent.Add("Ctx1-Val1", 2, true);
ctx.Add("Ctx1-Val1", 3, true);
ctxConcurrent.Add("Ctx1-Val1", 4, true);
Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 4);
Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 4);
}
示例5: PrepareStepForExecution
internal void PrepareStepForExecution(Context ctx)
{
foreach (Pair prop in propsToSet)
{
string name = (string)prop.First;
object[] args = (object[])prop.Second;
SetPropertyOnStep(name, args, ctx);
}
foreach (Pair prop in propsToTakeFromCtx)
{
string name = (string)prop.First;
string ctxPropName = (string)prop.Second;
object[] args = new object[1];
args[0] = ctx.GetObject(ctxPropName);
SetPropertyOnStep(name, args, ctx);
}
}