当前位置: 首页>>代码示例>>C#>>正文


C# INakedObject.TitleString方法代码示例

本文整理汇总了C#中INakedObject.TitleString方法的典型用法代码示例。如果您正苦于以下问题:C# INakedObject.TitleString方法的具体用法?C# INakedObject.TitleString怎么用?C# INakedObject.TitleString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INakedObject的用法示例。


在下文中一共展示了INakedObject.TitleString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PropertyTitle

 public static string PropertyTitle(this INakedObjectFeature feature, INakedObject nakedObject) {
     if (nakedObject == null) {
         return "";
     }
     string text = null;
     var regex = feature.GetFacet<IRegExFacet>();
     if (regex != null) {
         text = regex.Format(nakedObject.TitleString());
     }
     var mask = feature.GetFacet<IMaskFacet>();
     if (mask != null) {
         var title = feature.Specification.GetFacet<ITitleFacet>();
         text = title.GetTitleWithMask(mask.Value, nakedObject);
     }
     if (text == null) {
         text = nakedObject.TitleString();
     }
     return text;
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:19,代码来源:NakedObjectFeatureUtils.cs

示例2: ObjectToElement

        public Place ObjectToElement(INakedObject nakedObject) {
            Log.Debug("objectToElement(" + DoLog("object", nakedObject) + ")");

            INakedObjectSpecification nos = nakedObject.Specification;

            Log.Debug("objectToElement(NO): create element and nof:title");
            XElement element = Schema.CreateElement(XmlDocument, nos.ShortName, nos.FullName, nos.SingularName, nos.PluralName);
            NofMetaModel.AppendNofTitle(element, nakedObject.TitleString());

            Log.Debug("objectToElement(NO): create XS element for NOF class");
            XElement xsElement = Schema.CreateXsElementForNofClass(XsdDocument, element, topLevelElementWritten);

            // hack: every element in the XSD schema apart from first needs minimum cardinality setting.
            topLevelElementWritten = true;

            var place = new Place(nakedObject, element);

            NofMetaModel.SetAttributesForClass(element, OidOrHashCode(nakedObject));

            INakedObjectAssociation[] fields = nos.Properties;
            Log.Debug("objectToElement(NO): processing fields");

            var seenFields = new List<string>();

            foreach (INakedObjectAssociation field in fields) {
                string fieldName = field.Id;

                Log.Debug("objectToElement(NO): " + DoLog("field", fieldName));

                // Skip field if we have seen the name already
                // This is a workaround for getLastActivity(). This method exists
                // in AbstractNakedObject, but is not (at some level) being picked up
                // by the dot-net reflector as a property. On the other hand it does
                // exist as a field in the meta model (NakedObjectSpecification).
                //
                // Now, to re-expose the lastactivity field for .Net, a deriveLastActivity()
                // has been added to BusinessObject. This caused another field ofthe
                // same name, ultimately breaking the XSD.

                if (seenFields.Contains(fieldName)) {
                    Log.Debug("objectToElement(NO): " + DoLog("field", fieldName) + " SKIPPED");
                    continue;
                }
                seenFields.Add(fieldName);

                XNamespace ns = Schema.GetUri();

                var xmlFieldElement = new XElement(ns + fieldName);

                XElement xsdFieldElement;

                if (field.Specification.IsParseable) {
                    Log.Debug("objectToElement(NO): " + DoLog("field", fieldName) + " is value");

                    INakedObjectSpecification fieldNos = field.Specification;
                    // skip fields of type XmlValue
                    if (fieldNos != null &&
                        fieldNos.FullName != null &&
                        fieldNos.FullName.EndsWith("XmlValue")) {
                        continue;
                    }

                    var oneToOneAssociation = ((IOneToOneAssociation) field);
                    XElement xmlValueElement = xmlFieldElement; // more meaningful locally scoped name

                    try {
                        INakedObject value = oneToOneAssociation.GetNakedObject(nakedObject);

                        // a null value would be a programming error, but we protect
                        // against it anyway
                        if (value == null) {
                            continue;
                        }

                        INakedObjectSpecification valueNos = value.Specification;

                        // XML
                        NofMetaModel.SetAttributesForValue(xmlValueElement, valueNos.ShortName);

                        bool notEmpty = (value.TitleString().Length > 0);
                        if (notEmpty) {
                            string valueStr = value.TitleString();
                            xmlValueElement.Add(new XText(valueStr));
                        }
                        else {
                            NofMetaModel.SetIsEmptyAttribute(xmlValueElement, true);
                        }
                    }
                    catch (Exception) {
                        Log.Warn("objectToElement(NO): " + DoLog("field", fieldName) + ": getField() threw exception - skipping XML generation");
                    }

                    // XSD
                    xsdFieldElement = Schema.CreateXsElementForNofValue(xsElement, xmlValueElement);
                }
                else if (field is IOneToOneAssociation) {
                    Log.Debug("objectToElement(NO): " + DoLog("field", fieldName) + " is IOneToOneAssociation");

                    var oneToOneAssociation = ((IOneToOneAssociation) field);

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: DoLog

 private static string DoLog(string label, INakedObject nakedObject) {
     return DoLog(label, (nakedObject == null ? "(null)" : nakedObject.TitleString() + "[" + OidOrHashCode(nakedObject) + "]"));
 }
开发者ID:,项目名称:,代码行数:3,代码来源:

示例4: GetCompletionData

 private object GetCompletionData(INakedObject nakedObject, INakedObjectSpecification spec) {
     string label = nakedObject.TitleString();
     string value = nakedObject.TitleString();
     string link = spec.IsParseable ? label : FrameworkHelper.GetObjectId(nakedObject);
     string src = GetIconSrc(nakedObject);
     string alt = GetIconAlt(nakedObject);
     return new {label, value, link, src, alt};
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: DataUpdateException

 public DataUpdateException(INakedObject nakedObject, IVersion updated)
     : this(string.Format(Resources.NakedObjects.DataUpdateMessage, nakedObject.Version.User, nakedObject.TitleString(), DateTime.Now.ToLongTimeString(), Environment.NewLine, Environment.NewLine, nakedObject.Version, updated), nakedObject.Oid) {}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:2,代码来源:DataUpdateException.cs

示例6: GetServiceLabel

 public static string GetServiceLabel(INakedObject nakedObject) {
     return nakedObject.TitleString();
 }
开发者ID:,项目名称:,代码行数:3,代码来源:

示例7: CheckCanAssociate

 public static void CheckCanAssociate(this IResolveStateMachine stateMachine, INakedObject associate) {
     if (stateMachine.IsPersistent() && associate != null && associate.ResolveState.IsTransient()) {
         throw new TransientReferenceException(string.Format(Resources.NakedObjects.TransientErrorMessage, associate.TitleString()));
     }
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:5,代码来源:StateHelperUtils.cs

示例8: GetDisplayTitle

 private static string GetDisplayTitle(IFacetHolder holder, INakedObject nakedObject) {
     var mask = holder.GetFacet<IMaskFacet>();
     string title = mask != null ? nakedObject.Specification.GetFacet<ITitleFacet>().GetTitleWithMask(mask.Value, nakedObject) : nakedObject.TitleString();
     return string.IsNullOrWhiteSpace(title) && !nakedObject.Specification.IsParseable ? nakedObject.Specification.UntitledName : title;
 }
开发者ID:,项目名称:,代码行数:5,代码来源:

示例9: GetMaskedValue

 private static string GetMaskedValue(INakedObject valueNakedObject, IMaskFacet mask) {
     if (valueNakedObject != null) {
         return mask != null ? valueNakedObject.Specification.GetFacet<ITitleFacet>().GetTitleWithMask(mask.Value, valueNakedObject) : valueNakedObject.TitleString();
     }
     return null;
 }
开发者ID:,项目名称:,代码行数:6,代码来源:

示例10: GetSelectedForChoice

        private static bool GetSelectedForChoice(INakedObject choice, INakedObject existingNakedObject) {
            IEnumerable<INakedObject> existingNakedObjects;

            if (existingNakedObject == null) {
                existingNakedObjects = new INakedObject[] {};
            }
            else if (existingNakedObject.Specification.IsParseable || !existingNakedObject.Specification.IsCollection) {
                // isParseable to catch strings 
                existingNakedObjects = new[] {existingNakedObject};
            }
            else {
                existingNakedObjects = existingNakedObject.GetCollectionFacetFromSpec().AsEnumerable(existingNakedObject);
            }

            var enumFacet = choice.Specification.GetFacet<IEnumValueFacet>();

            if (enumFacet != null) {
                return existingNakedObjects.Any(no =>  no != null && enumFacet.IntegralValue(choice) == enumFacet.IntegralValue(no));
            }

            if (choice.Specification.IsParseable) {
                return existingNakedObjects.Any(no => choice.TitleString() == no.TitleString());
            }
            return existingNakedObjects.Any(no => choice == no);
        }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例11: GetTextForChoice

        private static string GetTextForChoice(INakedObject choice) {
            var enumFacet = choice.Specification.GetFacet<IEnumValueFacet>();

            if (enumFacet != null) {
                choice.TitleString();
            }

            return choice.TitleString();
        }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: GetValueForChoice

        private static string GetValueForChoice(INakedObject choice) {
            var enumFacet = choice.Specification.GetFacet<IEnumValueFacet>();

            if (enumFacet != null) {
                return enumFacet.IntegralValue(choice);
            }
            if (choice.Specification.IsParseable) {
                return choice.TitleString();
            }
            return FrameworkHelper.GetObjectId(choice);
        }
开发者ID:,项目名称:,代码行数:11,代码来源:


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