• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ValidationErrorHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ValidationErrorHandler的典型用法代码示例。如果您正苦于以下问题:C# ValidationErrorHandler类的具体用法?C# ValidationErrorHandler怎么用?C# ValidationErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValidationErrorHandler类属于命名空间,在下文中一共展示了ValidationErrorHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PeVerify

        private static string[] PeVerify(byte[] peImage, int domainId, string assemblyPath)
        {
            lock (s_guard)
            {
                GCHandle pinned = GCHandle.Alloc(peImage, GCHandleType.Pinned);
                try
                {
                    IntPtr buffer = pinned.AddrOfPinnedObject();

                    ICLRValidator validator = (ICLRValidator)RuntimeEnvironment.GetRuntimeInterfaceAsObject(s_clsIdClrRuntimeHost, typeof(ICLRRuntimeHost).GUID);
                    ValidationErrorHandler errorHandler = new ValidationErrorHandler(validator);

                    IMetaDataDispenser dispenser = (IMetaDataDispenser)RuntimeEnvironment.GetRuntimeInterfaceAsObject(s_clsIdCorMetaDataDispenser, typeof(IMetaDataDispenser).GUID);

                    // the buffer needs to be pinned during validation
                    Guid riid = typeof(IMetaDataImport).GUID;
                    object metaDataImport = null;
                    if (assemblyPath != null)
                    {
                        dispenser.OpenScope(assemblyPath, CorOpenFlags.ofRead, ref riid, out metaDataImport);
                    }
                    else
                    {
                        dispenser.OpenScopeOnMemory(buffer, (uint)peImage.Length, CorOpenFlags.ofRead, ref riid, out metaDataImport);
                    }

                    IMetaDataValidate metaDataValidate = (IMetaDataValidate)metaDataImport;
                    metaDataValidate.ValidatorInit(CorValidatorModuleType.ValidatorModuleTypePE, errorHandler);
                    metaDataValidate.ValidateMetaData();

                    validator.Validate(errorHandler, (uint)domainId, ValidatorFlags.VALIDATOR_EXTRA_VERBOSE,
                        ulMaxError: 10, token: 0, fileName: assemblyPath, pe: buffer, ulSize: (uint)peImage.Length);

                    return errorHandler.GetOutput();
                }
                finally
                {
                    pinned.Free();
                }
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:41,代码来源:CLRHelpers.cs


示例2: Rule02

        private static bool Rule02(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement context in list) {
                XmlElement	    startDate	= XPath.Path (context, "novation", "firstPeriodStartDate");
                XmlAttribute	href;

                if ((startDate == null) || (href = startDate.GetAttributeNode ("href"))== null) continue;

                XmlElement		target	= nodeIndex.GetElementById (href.Value);

                if ((target == null) || !target.LocalName.Equals("party")) {
                    errorHandler ("305", context,
                        "The @href attribute on the firstPeriodStartDate must reference a party",
                        name, href.Value);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:22,代码来源:BusinessProcessRules.cs


示例3: PerformValidation

 internal bool PerformValidation(NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Validate (nodeIndex, errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:4,代码来源:Validator.cs


示例4: Rule01

        private static bool Rule01(string name, NodeIndex nodeIndex, XmlNodeList list,
            ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement	 context in list) {
                XmlElement		generic	= XPath.Path (context, "generic");
                XmlAttribute	href;
                XmlElement		target;

                if ((generic == null) ||
                    ((href = generic.GetAttributeNode ("href")) == null) ||
                    ((target = nodeIndex.GetElementById (href.Value)) == null)) continue;

                string targetName = target.LocalName;

                if (targetName.Equals ("basket") ||
                    targetName.Equals ("cash") ||
                    targetName.Equals ("commodity") ||
                    targetName.Equals ("deposit") ||
                    targetName.Equals ("bond") ||
                    targetName.Equals ("convertibleBond") ||
                    targetName.Equals ("equity") ||
                    targetName.Equals ("exchangeTradedFund") ||
                    targetName.Equals ("index") ||
                    targetName.Equals ("future") ||
                    targetName.Equals ("fxRate") ||
                    targetName.Equals ("loan") ||
                    targetName.Equals ("mortgage") ||
                    targetName.Equals ("mutualFund") ||
                    targetName.Equals ("rateIndex") ||
                    targetName.Equals ("simpleCreditDefautSwap") ||
                    targetName.Equals ("simpleFra") ||
                    targetName.Equals ("simpleIrSwap") ||
                    targetName.Equals ("dealSummary") ||
                    targetName.Equals ("facilitySummary")) continue;

                errorHandler ("305", context,
                    "generic/@href must match the @id attribute of an element of type Asset",
                    name, targetName);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:45,代码来源:PricingAndRiskRules.cs


示例5: Rule02

        private static bool Rule02(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement context in list) {
                XmlAttribute	href;
                XmlElement		target;

                if (((href = context.GetAttributeNode ("href")) == null) ||
                    ((target = nodeIndex.GetElementById (href.Value)) == null)) continue;

                string targetName = target.LocalName;

                if (targetName.Equals ("creditCurve") ||
                    targetName.Equals ("fxCurve") ||
                    targetName.Equals ("volatilityRepresentation") ||
                    targetName.Equals ("yieldCurve")) continue;

                errorHandler ("305", context,
                    "@href must match the @id attribute of an element of type PricingStructure",
                    name, targetName);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:26,代码来源:PricingAndRiskRules.cs


示例6: Rule16

        // --------------------------------------------------------------------
        private static bool Rule16(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result = true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
                if (Implies (
                        And (
                            Equal (
                                Count (XPath.Paths (context, "generalTerms", "referenceInformation", "referenceObligation")), 1),
                            Exists (XPath.Path (context, "cashSettlementTerms", "valuationDate", "multipleValuationDates"))),
                        Or (
                            Equal (
                                XPath.Path (context, "cashSettlementTerms", "valuationMethod"),
                                "AverageMarket"),
                            Or (
                                Equal (
                                    XPath.Path (context, "cashSettlementTerms", "valuationMethod"),
                                    "Highest"),
                                Equal (
                                    XPath.Path (context, "cashSettlementTerms", "valuationMethod"),
                                    "AverageHighest")))))
                    continue;

                errorHandler ("305", context,
                    "If there is exactly one generalTerms/referenceInformation/referenceObligation " +
                    "and cashSettlementTerms/valuationDate/multipleValuationDates occurs " +
                    "then the value of cashSettlementTerms/valuationMethod must be " +
                    "AverageMarket, Highest or AverageHighest",
                    name, XPath.Path (context, "cashSettlementTerms", "valuationMethod").InnerText);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:35,代码来源:CdsRules.cs


示例7: Rule13

        // --------------------------------------------------------------------
        private static bool Rule13(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
                foreach (XmlElement buyer in XPath.Paths (context, "protectionTerms", "creditEvents", "creditEventNotice", "notifyingParty", "buyerPartyReference")) {
                    string		buyerName;
                    string		referenceName;

                    if (Equal (
                            buyerName = buyer.GetAttribute ("href"),
                            referenceName = XPath.Path (context, "generalTerms", "buyerPartyReference").GetAttribute ("href")))
                        continue;

                    errorHandler ("305", context,
                        "Credit event notice references buyer party reference " + buyerName +
                        " but general terms references " + referenceName,
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:25,代码来源:CdsRules.cs


示例8: Rule11

        // --------------------------------------------------------------------
        private static bool Rule11(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement trade in nodeIndex.GetElementsByName ("trade")) {
                if (IsIsda2003 (trade) && IsLongForm (trade)) {
                    XmlElement	context = XPath.Path (trade, "creditDefaultSwap", "generalTerms", "referenceInformation") as XmlElement;

                    if (Exists (XPath.Path (context, "allGuarantees"))) continue;

                    errorHandler ("305", context,
                        "allGuarantees element missing in protection terms",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:20,代码来源:CdsRules.cs


示例9: Rule44

 // --------------------------------------------------------------------
 private static bool Rule44(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule44 (name, nodeIndex.GetElementsByName ("creditDefaultSwap"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs


示例10: Rule43

        // --------------------------------------------------------------------
        private static bool Rule43(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
                if (!IsSingleName (context)) continue;

                if (!Exists (XPath.Path(context, "feeLeg", "initialPayment"))) continue;

                XmlElement	payer		= XPath.Path (context, "feeLeg", "initialPayment", "payerPartyReference");
                XmlElement	receiver 	= XPath.Path (context, "feeLeg", "initialPayment", "receiverPartyReference");
                XmlElement	seller		= XPath.Path (context, "generalTerms", "sellerPartyReference");
                XmlElement	buyer		= XPath.Path (context, "generalTerms", "buyerPartyReference");

                if ((payer != null) && (seller != null) && (receiver != null) && (buyer != null)) {
                    if (payer.GetAttribute ("href").Equals (buyer.GetAttribute ("href")) &&
                        receiver.GetAttribute ("href").Equals (seller.GetAttribute ("href")))
                        continue;
                }

                errorHandler ("305", context,
                    "The initial payment should be paid by the protection buyer to the protection seller",
                    name, null);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:29,代码来源:CdsRules.cs


示例11: Rule42

        // --------------------------------------------------------------------
        private static bool Rule42(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("generalTerms")) {
                XmlElement	basket			= XPath.Path (context, "basketReferenceInformation");
                XmlElement	substitution	= XPath.Path (context, "substitution");

                if ((basket == null) && (substitution != null)) {
                    errorHandler ("305", context,
                        "If basketReferenceInformation is not present then substitution must not be present.",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:19,代码来源:CdsRules.cs


示例12: Rule41

        // --------------------------------------------------------------------
        private static bool Rule41(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool		result 	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("generalTerms")) {
                XmlElement		tranche		= XPath.Path (context, "indexReferenceInformation", "tranche");
                XmlElement		delivery	= XPath.Path (context, "modifiedEquityDelivery");

                if ((tranche == null) && (delivery != null)) {
                    errorHandler ("305", context,
                        "If indexReferenceInformation/tranche is not present then modifiedEquityDelivery must not be present.",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:19,代码来源:CdsRules.cs


示例13: Rule40

        private static bool Rule40(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool		result = true;

            foreach (XmlElement context in list) {
                XmlElement	tranche	= XPath.Path (context, "generalTerms", "indexReferenceInformation", "tranche");
                XmlElement	attach	= XPath.Path (tranche, "attachmentPoint");
                XmlElement	exhaust	= XPath.Path (tranche, "exhaustionPoint");

                if ((attach == null) || (exhaust == null) || LessOrEqual (ToDecimal (attach), ToDecimal (exhaust))) continue;

                errorHandler ("305", tranche,
                        "attachmentPoint must be less than or equal to exhaustionPoint.",
                        name, null);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:19,代码来源:CdsRules.cs


示例14: Rule39

        private static bool Rule39(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool		result = true;

            foreach (XmlElement context in list) {
                XmlElement	info	= XPath.Path (context, "generalTerms", "basketReferenceInformation");
                XmlElement	nth		= XPath.Path (context, "nthToDefault");
                XmlElement	mth		= XPath.Path (context, "mthToDefault");

                if ((nth == null) || (mth == null) || (ToInteger (nth) < ToInteger (mth))) continue;

                errorHandler ("305", info,
                        "If nthToDefault is present and mthToDefault is present then nthToDefault must be less than mthToDefault.",
                        name, null);

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:19,代码来源:CdsRules.cs


示例15: Rule38

        private static bool Rule38(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool		result = true;

            foreach (XmlElement context in list) {
                XmlElement 	pool	= XPath.Path (context, "generalTerms", "basketReferenceInformation", "referencePool");
                XmlNodeList	items	= XPath.Paths (pool, "referencePoolItem", "constituentWeight", "basketPercentage");

                if (items.Count == 0) continue;

                Decimal total = 0;
                foreach (XmlElement item in items)
                    total += ToDecimal (item);

                if (Equal (total, decimal.One)) continue;

                errorHandler ("305", pool,
                        "The sum of referencePoolItem/constituentWeight/basketPercentage should be equal to 1",
                        name, total.ToString ());

                result = false;
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:24,代码来源:CdsRules.cs


示例16: Rule08

        private static bool Rule08(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool			result = true;

            foreach (XmlElement trade in list) {
                if (IsLongForm (trade)) {
                    XmlElement		context = XPath.Path (trade, "creditDefaultSwap", "generalTerms");

                    if (!Exists (XPath.Path (context, "scheduledTerminationDate"))) continue;

                    if (Or (
                            Exists (XPath.Path (context, "scheduledTerminationDate", "adjustableDate", "dateAdjustments")),
                            Exists (XPath.Path (context, "scheduledTerminationDate", "adjustableDate", "dateAdjustmentsReference"))))
                        continue;

                    errorHandler ("305", context,
                        "Neither date adjustments nor a date adjustments reference " +
                        "have been supplied for the scheduled termination date",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:25,代码来源:CdsRules.cs


示例17: Rule10

        // --------------------------------------------------------------------
        private static bool Rule10(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("referenceInformation")) {
                string			primaryReference;
                string			primaryId;

                foreach (XmlElement primary in XPath.Paths (context, "referenceObligation", "guarantorReference")) {
                    if (Equal (
                            primaryReference = primary.GetAttribute ("href"),
                            primaryId		 = context ["referenceEntity"].GetAttribute ("id")))
                        continue;

                    errorHandler ("305", context,
                        "Primary obligor reference '" + primaryReference +
                        "' should point to the reference entity ' " + primaryId + "'",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:25,代码来源:CdsRules.cs


示例18: Rule12

        // --------------------------------------------------------------------
        private static bool Rule12(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("referenceInformation")) {
                if (Exists (context ["referencePrice"])) {
                    if (GreaterOrEqual (context ["referencePrice"], 0.0))
                        continue;

                    errorHandler ("305", context,
                        "If referencePrice is present it must not have a negative " +
                        "value",
                        name, context ["referencePrice"].InnerText);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:20,代码来源:CdsRules.cs


示例19: Rule01b

        private static bool Rule01b(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement context in list) {
                XmlElement		cds;

                if (Exists (cds = XPath.Path (context, "creditDefaultSwap"))) {
                    if (!IsCreditIndex (cds)) continue;

                    XmlNode			tradeDate		= XPath.Path (context, "tradeHeader", "tradeDate");
                    XmlNode			effectiveDate	= XPath.Path (context, "creditDefaultSwap", "generalTerms", "effectiveDate", "unadjustedDate");

                    if ((tradeDate == null) || (effectiveDate == null) || !Less (tradeDate, effectiveDate ))
                        continue;

                    errorHandler ("305", context,
                        "Trade date " + tradeDate.InnerText.Trim () + " is not before " +
                        "effective date " + effectiveDate.InnerText.Trim (),
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:26,代码来源:CdsRules.cs


示例20: Rule14

        // --------------------------------------------------------------------
        private static bool Rule14(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            bool			result	= true;

            foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
                foreach (XmlElement seller in XPath.Paths (context, "protectionTerms", "creditEvents", "creditEventNotice", "notifyingParty", "sellerPartyReference")) {
                    if (Equal (seller.GetAttribute ("href"),
                            XPath.Path (context, "generalTerms", "sellerPartyReference").GetAttribute ("href")))
                        continue;

                    errorHandler ("305", context,
                        "If protectionTerms/creditEvents/creditEventNotice/notifyingParty/sellerPartyReference " +
                        "is present, its @href attribute must match that of generalTerms/sellerPartyReference",
                        name, null);

                    result = false;
                }
            }
            return (result);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:21,代码来源:CdsRules.cs



注:本文中的ValidationErrorHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ValidationErrors类代码示例发布时间:2022-05-24
下一篇:
C# ValidationErrorCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap