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


C# FieldList.Add方法代码示例

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


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

示例1: FakeItemAddMultipleFieldShouldReturnField

        public void FakeItemAddMultipleFieldShouldReturnField(FieldList fieldList, string fieldValue)
        {
            var fieldIdOne = ID.NewID;
            var fieldIdTwo = ID.NewID;
            fieldList.Add(fieldIdOne, fieldValue);
            fieldList.Add(fieldIdTwo, fieldValue);
            var fake = new FakeItem(fieldList);

            fake.Fields.Should().HaveCount(2);
        }
开发者ID:VGBenjamin,项目名称:Sitecore-Fakes,代码行数:10,代码来源:FakeItemTests.cs

示例2: FakeItemAddFieldShouldReturnField

 public void FakeItemAddFieldShouldReturnField(FieldList fieldList,string fieldValue)
 {
     var fieldId = ID.NewID;
     fieldList.Add(fieldId,fieldValue);
     var fake = new FakeItem(fieldList);
     fake[fieldId].ShouldBeEquivalentTo(fieldValue);
 }
开发者ID:VGBenjamin,项目名称:Sitecore-Fakes,代码行数:7,代码来源:FakeItemTests.cs

示例3: ColumnInfo

		public ColumnInfo( ObjectMap objectMap, string[] columnNames )
		{
			this.columnNames = columnNames;
			columnComboHashCode = ObjectConstructor.GetFieldComboHashCode( columnNames );
			fields = new FieldList();
			for( int i = 0; i < columnNames.Length; i++ )
			{
				string columnName = columnNames[ i ];
				FieldMap fm = objectMap.GetFieldMapFromColumn( columnName );
				if( fm == null )
				{
					// check for column names with table name prefixes
					int pos = columnName.IndexOf( '.' );
					if( pos > 0 )
					{
						columnName = columnName.Substring( pos + 1, columnName.Length - pos - 1 );
						fm = objectMap.GetFieldMapFromColumn( columnName );
						if( fm != null )
						{
							columnNames[ i ] = columnName;
						}
					}
					if( fm == null ) // no corresponding member could be found - assume column is calculated
					{
						columnCalculatedMask |= 1 << i;
					}
				}
				fields.Add( fm ); // intentionally add null entries to preserve column order 
			}
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:30,代码来源:ColumnInfo.cs

示例4: Resolve

 public Resolve(string name, params string[] shows)
 {
     Name = name;
     Show = new FieldList();
     foreach (var show in shows) {
         Show.Add(show);
     }
 }
开发者ID:Krusen,项目名称:soe-census-api-csharp,代码行数:8,代码来源:Resolve.cs

示例5: FakeItemGetFieldFromIdShoudlReturnFieldValue

        public void FakeItemGetFieldFromIdShoudlReturnFieldValue(string fieldValue, FieldList fieldList)
        {
            var fieldId = ID.NewID;

            fieldList.Add(fieldId, fieldValue);
            var fake = new FakeItem(fieldList);

            fake[fieldId].ShouldAllBeEquivalentTo(fieldValue);
        }
开发者ID:VGBenjamin,项目名称:Sitecore-Fakes,代码行数:9,代码来源:FakeItemTests.cs

示例6: GetItemFields

		public override FieldList GetItemFields(ItemDefinition item, VersionUri version, CallContext context)
		{
			Assert.ArgumentNotNull(item, "item");
			Assert.ArgumentNotNull(version, "version");
			Assert.ArgumentNotNull(context, "context");

			var action = ControllerAction.GetControllerAction(ParentId, item.ID);
			if (action == null)
			{
				return base.GetItemFields(item, version, context);
			}

			FieldList list = new FieldList();
			var template = context.DataManager.Database.GetTemplate(BaseTemplateId);
			list.Add(template.GetField("Namespace").ID, typeof(MvcActionLoader).Namespace);
			list.Add(template.GetField("Tag").ID, typeof(MvcActionLoader).Name);
			list.Add(template.GetField("TagPrefix").ID, "mvc");
			list.Add(template.GetField("Assembly").ID, typeof(MvcActionLoader).Assembly.GetName().Name);
			list.Add(FieldIDs.Icon, Themes.MapTheme("SoftwareV2/16x16/element_selection.png"));
			return list;
		}
开发者ID:bplasmeijer,项目名称:BoC.Sitecore.MVC,代码行数:21,代码来源:MvcSubLayoutDataProvider.cs

示例7: FieldAddingLinkFieldWithLinkFromOneItemToAnotherTargetItemShouldReturnLinkedToItem

        public void FieldAddingLinkFieldWithLinkFromOneItemToAnotherTargetItemShouldReturnLinkedToItem()
        {
            var linkedToItem = new FakeItem();
            var fakeLinkField = new FakeInternalLinkField(linkedToItem);

            var fieldId = ID.NewID;
            var fieldCollection = new FieldList();
            fieldCollection.Add(fieldId,fakeLinkField.ToString());

            var itemToLinkFrom = new FakeItem(fieldCollection);

            var sitecoreLinkField = (LinkField) itemToLinkFrom.Fields[fieldId];

            sitecoreLinkField.TargetItem.ID.ShouldBeEquivalentTo(linkedToItem.ID);
        }
开发者ID:VGBenjamin,项目名称:Sitecore-Fakes,代码行数:15,代码来源:FakeLinkFieldTests.cs

示例8: CreateFakeItem

        public static Item CreateFakeItem(Dictionary<Guid, string> fields, ID templateId, Database database, string name = "ItemName")
        {
            var id = new ID(Guid.NewGuid());
            var language = Language.Current;
            var version = Sitecore.Data.Version.Latest;

            var itemDefinition = new ItemDefinition(id, name, templateId, ID.Null);
            var fieldList = new FieldList();

            if (fields != null)
            {
                foreach (var fieldId in fields.Keys)
                {
                    fieldList.Add(new ID(fieldId), fields[fieldId]);
                }
            }

            var itemData = new ItemData(itemDefinition, language, version, fieldList);
            var item = new Item(id, itemData, database);
            return item;
        }
开发者ID:uv20,项目名称:Glass.Mapper,代码行数:21,代码来源:Utilities.cs

示例9: GetItemFields

        public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context)
        {
            var fields = new FieldList();

            if (itemDefinition == ItemDefinition.Empty)
            {
                return fields;
            }

            var database = GetDatabase(context);
            var syncItem = database.GetItem(itemDefinition.ID.ToString(), versionUri.Language.Name);

            if (syncItem == null)
            {
                return fields;
            }

            foreach (var syncField in syncItem.SharedFields)
            {
                fields.Add(ID.Parse(syncField.FieldID), syncField.FieldValue);
            }

            var syncVersion = syncItem.GetLatestVersions().Where(v => v.Language.Equals(versionUri.Language.Name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (syncVersion == null)
            {
                return fields;
            }

            foreach (var syncField in syncVersion.Fields)
            {
                fields.Add(ID.Parse(syncField.FieldID), syncField.FieldValue);
            }

            return fields;
        }
开发者ID:jerrong,项目名称:SitecoreData,代码行数:36,代码来源:SerializationDataProvider.cs

示例10: VisitTypeReference

    public override TypeNode VisitTypeReference(TypeNode type){ //TODO: break up this method
      if (type == null) return null;
      TypeNodeList pars = this.pars;
      TypeNodeList args = this.args;
      switch (type.NodeType){
        case NodeType.ArrayType:
          ArrayType arrType = (ArrayType)type;
          TypeNode elemType = this.VisitTypeReference(arrType.ElementType);
          if (elemType == arrType.ElementType || elemType == null) return arrType;
          if (arrType.IsSzArray()) return elemType.GetArrayType(1);
          return elemType.GetArrayType(arrType.Rank, arrType.Sizes, arrType.LowerBounds);
#if !MinimalReader
        case NodeType.DelegateNode:{
          FunctionType ftype = type as FunctionType;
          if (ftype == null) goto default;
          TypeNode referringType = ftype.DeclaringType == null ? this.CurrentType : this.VisitTypeReference(ftype.DeclaringType);
          return FunctionType.For(this.VisitTypeReference(ftype.ReturnType), this.VisitParameterList(ftype.Parameters), referringType);}
#endif
        case NodeType.Pointer:
          Pointer pType = (Pointer)type;
          elemType = this.VisitTypeReference(pType.ElementType);
          if (elemType == pType.ElementType || elemType == null) return pType;
          return elemType.GetPointerType();
        case NodeType.Reference:
          Reference rType = (Reference)type;
          elemType = this.VisitTypeReference(rType.ElementType);
          if (elemType == rType.ElementType || elemType == null) return rType;
          return elemType.GetReferenceType();
#if ExtendedRuntime
        case NodeType.TupleType:{
          TupleType tType = (TupleType)type;
          bool reconstruct = false;
          MemberList members = tType.Members;
          int n = members == null ? 0 : members.Count;
          FieldList fields = new FieldList(n);
          for (int i = 0; i < n; i++){
            //^ assert members != null;
            Field f = members[i] as Field;
            if (f == null) continue;
            f = (Field)f.Clone();
            fields.Add(f);
            TypeNode oft = f.Type;
            TypeNode ft = f.Type = this.VisitTypeReference(f.Type);
            if (ft != oft) reconstruct = true;
          }
          if (!reconstruct) return tType;
          TypeNode referringType = tType.DeclaringType == null ? this.CurrentType : this.VisitTypeReference(tType.DeclaringType);
          return TupleType.For(fields, referringType);}
        case NodeType.TypeIntersection:{
          TypeIntersection tIntersect = (TypeIntersection)type;
          TypeNode referringType = tIntersect.DeclaringType == null ? this.CurrentType : this.VisitTypeReference(tIntersect.DeclaringType);
          return TypeIntersection.For(this.VisitTypeReferenceList(tIntersect.Types), referringType);}
        case NodeType.TypeUnion:{
          TypeUnion tUnion = (TypeUnion)type;
          TypeNode referringType = tUnion.DeclaringType == null ? this.CurrentType : this.VisitTypeReference(tUnion.DeclaringType);
          TypeNodeList types = this.VisitTypeReferenceList(tUnion.Types);
          if (referringType == null || types == null) { Debug.Fail(""); return null; }
          return TypeUnion.For(types, referringType);}
#endif
#if !MinimalReader        
        case NodeType.ArrayTypeExpression:
          ArrayTypeExpression aExpr = (ArrayTypeExpression)type;
          aExpr.ElementType = this.VisitTypeReference(aExpr.ElementType);
          return aExpr;
        case NodeType.BoxedTypeExpression:
          BoxedTypeExpression bExpr = (BoxedTypeExpression)type;
          bExpr.ElementType = this.VisitTypeReference(bExpr.ElementType);
          return bExpr;
        case NodeType.ClassExpression:{
          ClassExpression cExpr = (ClassExpression)type;
          cExpr.Expression = this.VisitTypeExpression(cExpr.Expression);
          Literal lit = cExpr.Expression as Literal; //Could happen if the expression is a template parameter
          if (lit != null) return lit.Value as TypeNode;
          cExpr.TemplateArguments = this.VisitTypeReferenceList(cExpr.TemplateArguments);
          return cExpr;}
#endif
        case NodeType.ClassParameter:
        case NodeType.TypeParameter:
          int key = type.UniqueKey;
          var mappedTarget = this.forwarding[key] as TypeNode;
          if (mappedTarget != null) return mappedTarget;
          for (int i = 0, n = pars == null ? 0 : pars.Count, m = args == null ? 0 : args.Count; i < n && i < m; i++){
            //^ assert pars != null && args != null;
            TypeNode tp = pars[i];
            if (tp == null) continue;
            if (tp.UniqueKey == key) return args[i];
#if false
            if (tp.Name.UniqueIdKey == type.Name.UniqueIdKey && (tp is ClassParameter && type is TypeParameter)) {
              //This shouldn't really happen, but in practice it does. Hack past it.
              Debug.Assert(false);
              return args[i];
            }
#endif
          }
          return type;
#if ExtendedRuntime
        case NodeType.ConstrainedType:{
          ConstrainedType conType = (ConstrainedType)type;
          TypeNode referringType = conType.DeclaringType == null ? this.CurrentType : this.VisitTypeReference(conType.DeclaringType);
          TypeNode underlyingType = this.VisitTypeReference(conType.UnderlyingType);
//.........这里部分代码省略.........
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:101,代码来源:Specializer.cs

示例11: AddFieldsFromTemplate

    protected void AddFieldsFromTemplate(FieldList allFields, DbItem fakeItem, DbTemplate fakeTemplate, Language language, Version version)
    {
      var sourceItem = this.GetSourceItem(fakeItem);

      foreach (var templateField in fakeTemplate.Fields)
      {
        var fieldId = templateField.ID;

        var itemField = this.FindItemDbField(fakeItem, templateField);
        if (itemField == null)
        {
          continue;
        }

        var value = itemField.GetValue(language.Name, version.Number);
        if (sourceItem != null && string.IsNullOrWhiteSpace(value))
        {
          continue;
        }

        if (value != null)
        {
          allFields.Add(fieldId, value);
        }
      }

      foreach (var template in fakeTemplate.BaseIDs.Select(this.GetFakeTemplate).Where(t => t != null))
      {
        this.AddFieldsFromTemplate(allFields, fakeItem, template, language, version);
      }

      if (fakeTemplate.BaseIDs.Any() || fakeTemplate.ID == TemplateIDs.StandardTemplate)
      {
        return;
      }

      var standardTemplate = this.GetFakeTemplate(TemplateIDs.StandardTemplate);
      this.AddFieldsFromTemplate(allFields, fakeItem, standardTemplate, language, version);
    }
开发者ID:dharnitski,项目名称:Sitecore.FakeDb,代码行数:39,代码来源:DataStorage.cs

示例12: GetFieldFields

        private void GetFieldFields(FieldInfo info, FieldList fields){

            if (!string.IsNullOrEmpty(info.Title))
                fields.Add(TitleFieldId, info.Title);

            fields.Add(TypeFieldId, FieldInfo.GetFieldType(info.Type));

            if (!string.IsNullOrEmpty(info.Source))
                fields.Add(SourceFieldId, info.Source);

            fields.Add(TemplateFieldIDs.Shared, info.IsShared ? "1" : "0");
            fields.Add(TemplateFieldIDs.Unversioned, info.IsUnversioned ? "1" : "0");
            foreach (var fieldFieldValue in info.FieldFieldValues)
            {
                fields.Add(ID.Parse(fieldFieldValue.Key), fieldFieldValue.Value);
            }
            fields.Add(TemplateFieldIDs.Validation, info.ValidationRegularExpression ?? "");
            fields.Add(TemplateFieldIDs.ValidationText, info.ValidationErrorText ?? "");

            if (info.IsRequired)
            {
                fields.Add(QuickActionBarFieldId, IsRequiredId);
                fields.Add(ValidateButtonFieldId, IsRequiredId);
                fields.Add(ValidatorBarFieldId, IsRequiredId);
                fields.Add(WorkflowFieldId, IsRequiredId);
            }
        }
开发者ID:csteeg,项目名称:Glass.Sitecore.Mapper,代码行数:27,代码来源:GlassDataProvider.cs

示例13: GetStandardFields

 /// <summary>
 /// Gets the standard fields.
 /// </summary>
 /// <param name="fields">The fields.</param>
 /// <param name="index">The index.</param>
 private void GetStandardFields(FieldList fields, int index)
 {
     fields.Add(FieldIDs.ReadOnly, "1");
     fields.Add(FieldIDs.Sortorder, index.ToString());
 }
开发者ID:bplasmeijer,项目名称:Glass.Mapper,代码行数:10,代码来源:GlassDataProvider.cs

示例14: GetItemFields

        public virtual FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context)
        {
            // return null if not present, should return all shared fields as well as all fields in the version
            Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
            Assert.ArgumentNotNull(versionUri, "versionUri");

            if (DisableSerialization || DisableTransparentSync || itemDefinition == ItemDefinition.Empty) return null;

            var item = GetTargetFromId(itemDefinition.ID);

            if (item == null) return null;

            var fields = new FieldList();

            foreach (var sharedField in item.SharedFields)
            {
                fields.Add(new ID(sharedField.FieldId), sharedField.BlobId.HasValue ? sharedField.BlobId.ToString() : sharedField.Value);
            }

            var version = item.Versions.FirstOrDefault(v => v.VersionNumber == versionUri.Version.Number && v.Language.Name == versionUri.Language.Name);

            if (version == null) return fields;

            foreach (var versionedField in version.Fields)
            {
                fields.Add(new ID(versionedField.FieldId), versionedField.BlobId.HasValue ? versionedField.BlobId.ToString() : versionedField.Value);
            }

            fields.Add(FieldIDs.UpdatedBy, TransparentSyncUpdatedByValue);
            fields.Add(FieldIDs.Revision, Guid.NewGuid().ToString());

            AddBlobsToCache(item);

            return fields;
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:35,代码来源:UnicornDataProvider.cs

示例15: GetItemFields

		public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context)
		{
			Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
			Assert.ArgumentNotNull(versionUri, "versionUri");

			if (itemDefinition == ItemDefinition.Empty) return null;

			var syncItem = SerializedDatabase.GetItem(itemDefinition.ID);

			if (syncItem == null) return null;

			var fields = new FieldList();

			foreach (var sharedField in syncItem.SharedFields)
			{
				fields.Add(sharedField.GetSitecoreId(), sharedField.FieldValue);
			}

			var syncVersion = syncItem.GetVersion(versionUri);

			if (syncVersion == null) return fields;

			foreach (var versionedField in syncVersion.Fields)
			{
				fields.Add(versionedField.GetSitecoreId(), versionedField.FieldValue);
			}

			return fields;
		}
开发者ID:Vittel,项目名称:Rhino,代码行数:29,代码来源:SerializationDataProvider.cs


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