本文整理汇总了C#中Persistence类的典型用法代码示例。如果您正苦于以下问题:C# Persistence类的具体用法?C# Persistence怎么用?C# Persistence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Persistence类属于命名空间,在下文中一共展示了Persistence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
protected override XElement Validate(XElement item)
{
// Validate with XSD
XElement xsdErrors = this.ValidateXSD(item, HttpContext.Current.Server.MapPath(@"~\Xslt\Senior\Senior.xsd"));
if (xsdErrors != null && xsdErrors.Elements("Error").Count() > 0)
{
return xsdErrors;
}
// Validate with Stored Proc
string result = string.Empty;
using (Persistence oDB = new Persistence())
{
Persistence.ParameterCollection parameters = new Persistence.ParameterCollection();
parameters.Add("InputXml");
parameters[0].Value = item.ToString();
oDB.Execute("Masters_ConnectionString", "ValidateSeniorData", parameters, out result);
}
if (!string.IsNullOrEmpty(result))
{
XElement spErrors = XElement.Parse(result);
spErrors.Elements("Error").Where(e => string.IsNullOrEmpty(e.Value)).Remove();
if (spErrors.Elements("Error").Count() > 0)
{
return spErrors;
}
}
// SUCCESS!
return null;
}
示例2: Export
public void Export(Persistence.Lookup settings)
{
settings.Add("AgeSpecies", mKey.mAgeSpecies.ToString());
settings.Add("Occult", mKey.mOccult.ToString());
settings.Add("Commodity", mKey.mKind.ToString());
settings.Add("Value", mValue);
}
示例3: ConvertLayoutTypes
private static void ConvertLayoutTypes(TypeVisualiserLayoutFile oldDiagram, Persistence.CanvasLayoutData canvasLayoutv105)
{
foreach (TypeLayoutData oldType in oldDiagram.ViewportSaveData.CanvasLayout.Types)
{
TypeLayoutData copyOfOldType = oldType;
AssociationData association = oldDiagram.ViewportSaveData.Subject.Associations.FirstOrDefault(x => x.AssociatedTo.Id == copyOfOldType.Id);
if (association == null)
{
if (oldDiagram.ViewportSaveData.Subject.Implements != null)
{
association = oldDiagram.ViewportSaveData.Subject.Implements.FirstOrDefault(x => x.AssociatedTo.Id == oldType.Id);
}
if (association == null && oldDiagram.ViewportSaveData.Subject.Parent != null)
{
association = oldDiagram.ViewportSaveData.Subject.Parent.AssociatedTo.Id == oldType.Id ? oldDiagram.ViewportSaveData.Subject.Parent : null;
}
}
if (association == null)
{
throw new NotSupportedException("Association Id " + oldType.Id + " not found in the Subject's data. Cannot deserialise from this data.");
}
var newType = new Persistence.TypeLayoutData { Id = oldType.Id.ToString(), TopLeft = oldType.TopLeft, Visible = oldType.Visible, ContentType = association.GetType().FullName, };
canvasLayoutv105.Types.Add(newType);
}
}
示例4: Import
public void Import(Persistence.Lookup settings)
{
MasterController.Settings.SkillStamps.Clear();
MasterController.Settings.SkillStamps.AddRange(settings.GetList<SkillStamp>(""));
MasterController.Settings.UpdateStamp();
}
示例5: Tracker
public Tracker(Persistence.IPersister persister, Persistence.Finder.IItemFinder find, N2.Web.IUrlParser urlParser, N2.Web.IErrorHandler errorHandler)
{
this.persister = persister;
this.find = find;
this.urlParser = urlParser;
this.errorHandler = errorHandler;
}
示例6: Clear_ShouldClearAllAndLog
public void Clear_ShouldClearAllAndLog(
[Frozen]Mock<ILogger> logger,
[Frozen]Mock<IEntityFrameworkContext> efContext,
[Frozen]Mock<IAzureQueueContext> aqContext,
[Frozen]Mock<IAzureTableContext> atContext,
[Frozen]Mock<IAzureBlobContext> abContext,
[Frozen]Mock<IEntityFrameworkChangeTracker> changeTracker,
Persistence.UnitOfWork uow)
{
EntityFrameworkContextExtensions.Factory = efc => changeTracker.Object;
// Act
uow.Clear();
// Assert
changeTracker.Verify(t => t.Clear(), Times.Once);
aqContext.Verify(c => c.Clear(), Times.Once);
atContext.Verify(c => c.Clear(), Times.Once);
abContext.Verify(c => c.Clear(), Times.Once);
logger.Verify(l => l.Log("Clearing Entity Framework context..."), Times.Once);
logger.Verify(l => l.Log("Clearing Azure Queue context..."), Times.Once);
logger.Verify(l => l.Log("Clearing Azure Table context..."), Times.Once);
logger.Verify(l => l.Log("Clearing Azure Blob context..."), Times.Once);
}
示例7: SecurityEnforcer
public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, Definitions.IDefinitionManager definitions, Web.IUrlParser urlParser, Web.IWebContext webContext)
{
this.webContext = webContext;
this.persister = persister;
this.security = security;
this.definitions = definitions;
this.urlParser = urlParser;
}
示例8: Recommendation
/// <summary>
/// Initializes a new instance of the <see cref="Recommendation"/> class.
/// </summary>
/// <param name="recommendation">The recommendation.</param>
public Recommendation(Persistence.Recommendation recommendation)
{
this.ID = recommendation.ID;
this.UserID = recommendation.UserID;
this.OperatingSystem = recommendation.OSID;
this.Description = recommendation.Description;
this.AppName = recommendation.AppDesignation;
}
示例9: Export
public void Export(Persistence.Lookup settings)
{
if (mName == null) return;
settings.Add("Name", mName);
settings.Add("Criteria", mElements);
}
示例10: SecurityEnforcer
public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, ContentActivator activator, Web.IUrlParser urlParser, Web.IWebContext webContext)
{
this.webContext = webContext;
this.persister = persister;
this.security = security;
this.activator = activator;
this.urlParser = urlParser;
}
示例11: getInstance
public static Persistence getInstance()
{
if(_instance == null)
{
_instance = GameObject.FindObjectOfType<Persistence>();
}
return _instance;
}
示例12: Export
public override void Export(Persistence.Lookup settings)
{
base.Export(settings);
if (mValue != null)
{
settings.Add("Value", mValue.ToString());
}
}
示例13: Import
public void Import(Persistence.Lookup settings)
{
mKey = new MotiveKey(
settings.GetEnum<CASAgeGenderFlags>("AgeSpecies", CASAgeGenderFlags.None),
settings.GetEnum<OccultTypes>("Occult", OccultTypes.None),
settings.GetEnum<CommodityKind>("Commodity", CommodityKind.None)
);
mValue = settings.GetFloat("Value", 1);
}
示例14: User
/// <summary>
/// Initializes a new instance of the <see cref="User"/> class.
/// </summary>
/// <param name="user">The user.</param>
public User(Persistence.User user)
{
this.ID = user.ID;
this.FirstName = user.FirstName;
this.Lastname = user.LastName;
this.Children = user.Children;
this.CountryOfOriginID = user.CountryOfOriginID;
this.IsAdmin = user.Admin != null;
}
示例15: SecurityEnforcer
public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, ContentActivator activator, Web.IUrlParser urlParser, Web.IWebContext webContext, Configuration.HostSection config)
{
this.webContext = webContext;
this.persister = persister;
this.security = security;
this.activator = activator;
this.urlParser = urlParser;
this.permissionDeniedHttpCode = config.Web.PermissionDeniedHttpCode;
}