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

C# IProperty类代码示例

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

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



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

示例1: HasPublicModifier

        public static bool HasPublicModifier(IProperty property)
        {
            try
            {
                if (property.Getter == null)
                {
                    return false;
                }

                var declaration = property.GetDeclarations().FirstOrDefault();
                if (declaration == null)
                {
                    return false;
                }

                var memberDeclaration = declaration as ICSharpTypeMemberDeclaration;
                if (memberDeclaration == null)
                {
                    return false;
                }

                return memberDeclaration.ModifiersList.Modifiers.Any(m => m.GetTokenType() == CSharpTokenType.PUBLIC_KEYWORD);
            }
            catch (Exception exn)
            {
                Debug.WriteLine(exn);
                return false;
            }
        }
开发者ID:oriches,项目名称:Resharper.ReactivePlugin,代码行数:29,代码来源:PropertyHelper.cs


示例2: PropertyDefinition

 public override string PropertyDefinition(IProperty property)
 {
     bool hasTick = property.PropertyType.IsRef && !property.PropertyType.IsGenericTypeArg;
     StringBuilder sb = new StringBuilder("public:").AppendLine();
     sb.Append("property ").Append(TypeName(property.PropertyType)).Append(' ');
     if (hasTick)
         sb.Append('^');
     sb.Append(property.DisplayName).AppendLine(" {");
     if (property.HasGetter)
     {
         sb.Append(Tabulator).Append(TypeName(property.PropertyType)).Append(' ');
         if (hasTick)
             sb.Append('^');
         sb.AppendLine("get();");
     }
     if (property.HasSetter)
     {
         sb.Append(Tabulator);
         if (property.SetterAccess.HasValue && property.SetterAccess.Value == AccessModifier.Protected)
             sb.Append("protected: ");
         sb.Append("void set(")
             .Append(TypeName(property.PropertyType))
             .Append(' ');
         if (hasTick)
             sb.Append('^');
         sb.AppendLine("value);");
     }
     sb.Append("}");
     return sb.ToString();
 }
开发者ID:Alxandr,项目名称:NuDoc,代码行数:30,代码来源:CPPLanguageService.cs


示例3: ForeignKeyPropertyChangedAction

        private void ForeignKeyPropertyChangedAction(InternalEntityEntry entry, IProperty property, object oldValue, object newValue)
        {
            foreach (var foreignKey in entry.EntityType.GetForeignKeys().Where(p => p.Properties.Contains(property)).Distinct())
            {
                var navigations = _model.GetNavigations(foreignKey).ToList();

                var oldPrincipalEntry = entry.StateManager.GetPrincipal(entry.RelationshipsSnapshot, foreignKey);
                if (oldPrincipalEntry != null)
                {
                    Unfixup(navigations, oldPrincipalEntry, entry);
                }

                var principalEntry = entry.StateManager.GetPrincipal(entry, foreignKey);
                if (principalEntry != null)
                {
                    if (foreignKey.IsUnique)
                    {
                        var oldDependents = entry.StateManager.GetDependents(principalEntry, foreignKey).Where(e => e != entry).ToList();

                        // TODO: Decide how to handle case where multiple values found (negative case)
                        // Issue #739
                        if (oldDependents.Count > 0)
                        {
                            StealReference(foreignKey, oldDependents[0]);
                        }
                    }

                    DoFixup(navigations, principalEntry, new[] { entry });
                }
            }
        }
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:31,代码来源:NavigationFixer.cs


示例4: NextAsync

        public virtual async Task<object> NextAsync(StateEntry stateEntry, IProperty property, CancellationToken cancellationToken = default(CancellationToken))
        {
            Check.NotNull(stateEntry, "stateEntry");
            Check.NotNull(property, "property");

            var newValue = GetNextValue();

            // If the chosen value is outside of the current block then we need a new block.
            // It is possible that other threads will use all of the new block before this thread
            // gets a chance to use the new new value, so use a while here to do it all again.
            while (newValue.Current >= newValue.Max)
            {
                // Once inside the lock check to see if another thread already got a new block, in which
                // case just get a value out of the new block instead of requesting one.
                using (await _lock.LockAsync(cancellationToken))
                {
                    if (newValue.Max == _currentValue.Max)
                    {
                        var commandInfo = PrepareCommand(stateEntry.Configuration);

                        var newCurrent = (long)await _executor.ExecuteScalarAsync(commandInfo.Item1.DbConnection, commandInfo.Item1.DbTransaction, commandInfo.Item2, cancellationToken).ConfigureAwait(false);
                        newValue = new SequenceValue(newCurrent, newCurrent + _blockSize);
                        _currentValue = newValue;
                    }
                    else
                    {
                        newValue = GetNextValue();
                    }
                }
            }

            return Convert.ChangeType(newValue.Current, property.PropertyType);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:33,代码来源:SqlServerSequenceValueGenerator.cs


示例5: PropertyResult

        public PropertyResult(IProperty source)
        {
            if (source == null) return;

            _alias = source.Alias;
            _value = source.Value;
        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:7,代码来源:PropertyResult.cs


示例6: TryMatchFieldName

        public virtual FieldInfo TryMatchFieldName(
            IProperty property, PropertyInfo propertyInfo, Dictionary<string, FieldInfo> dclaredFields)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(propertyInfo, nameof(propertyInfo));
            Check.NotNull(dclaredFields, nameof(dclaredFields));

            var propertyName = propertyInfo.Name;
            var propertyType = propertyInfo.PropertyType.GetTypeInfo();

            var camelized = char.ToLowerInvariant(propertyName[0]) + propertyName.Substring(1);

            FieldInfo fieldInfo;
            return (dclaredFields.TryGetValue(camelized, out fieldInfo)
                    && fieldInfo.FieldType.GetTypeInfo().IsAssignableFrom(propertyType))
                   || (dclaredFields.TryGetValue("_" + camelized, out fieldInfo)
                       && fieldInfo.FieldType.GetTypeInfo().IsAssignableFrom(propertyType))
                   || (dclaredFields.TryGetValue("_" + propertyName, out fieldInfo)
                       && fieldInfo.FieldType.GetTypeInfo().IsAssignableFrom(propertyType))
                   || (dclaredFields.TryGetValue("m_" + camelized, out fieldInfo)
                       && fieldInfo.FieldType.GetTypeInfo().IsAssignableFrom(propertyType))
                   || (dclaredFields.TryGetValue("m_" + propertyName, out fieldInfo)
                       && fieldInfo.FieldType.GetTypeInfo().IsAssignableFrom(propertyType))
                ? fieldInfo
                : null;
        }
开发者ID:thegido,项目名称:EntityFramework,代码行数:26,代码来源:FieldMatcher.cs


示例7: GetTypeMapping

 public virtual RelationalTypeMapping GetTypeMapping(IProperty property)
     => GetTypeMapping(
         property.Relational().ColumnType,
         property.Relational().Column,
         property.ClrType.UnwrapNullableType(),
         property.IsKey() || property.IsForeignKey(),
         property.IsConcurrencyToken);
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:7,代码来源:RelationalTypeMapper.cs


示例8: GetOrAdd

        public virtual ValueGenerator GetOrAdd(IProperty property, Func<IProperty, ValueGenerator> factory)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(factory, nameof(factory));

            return _cache.GetOrAdd(property, factory);
        }
开发者ID:thegido,项目名称:EntityFramework,代码行数:7,代码来源:ValueGeneratorCache.cs


示例9: ForeignKeyPropertyChanged

        public virtual void ForeignKeyPropertyChanged(StateEntry entry, IProperty property, object oldValue, object newValue)
        {
            Check.NotNull(entry, "entry");
            Check.NotNull(property, "property");

            PerformFixup(() => ForeignKeyPropertyChangedAction(entry, property, oldValue, newValue));
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:NavigationFixer.cs


示例10: Next

        public override object Next(StateEntry entry, IProperty property)
        {
            Check.NotNull(entry, "entry");
            Check.NotNull(property, "property");

            return Convert.ChangeType(Interlocked.Increment(ref _current), property.PropertyType);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:InMemoryValueGenerator.cs


示例11: CreatePool

 private static IValueGeneratorPool CreatePool(IProperty property, IValueGeneratorFactory factory)
 {
     var poolSize = factory.GetPoolSize(property);
     return poolSize == 1
         ? (IValueGeneratorPool)new SingleValueGeneratorPool(factory, property)
         : new ValueGeneratorPool(factory, property, poolSize);
 }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:ValueGeneratorCache.cs


示例12: Next

        public override object Next(StateEntry entry, IProperty property)
        {
            Check.NotNull(property, "property");

            Contract.Assert(property.IsForeignKey());

            var entityType = property.EntityType;
            var stateManager = entry.Configuration.StateManager;

            foreach (var foreignKey in entityType.ForeignKeys)
            {
                for (var propertyIndex = 0; propertyIndex < foreignKey.Properties.Count; propertyIndex++)
                {
                    if (property == foreignKey.Properties[propertyIndex])
                    {
                        foreach (var navigation in entityType.Navigations
                            .Concat(foreignKey.ReferencedEntityType.Navigations)
                            .Where(n => n.ForeignKey == foreignKey)
                            .Distinct())
                        {
                            var principal = TryFindPrincipal(stateManager, navigation, entry.Entity);

                            if (principal != null)
                            {
                                var principalEntry = stateManager.GetOrCreateEntry(principal);

                                return principalEntry[foreignKey.ReferencedProperties[propertyIndex]];
                            }
                        }
                    }
                }
            }

            return null;
        }
开发者ID:charlyraffellini,项目名称:EntityFramework,代码行数:35,代码来源:ForeignKeyValueGenerator.cs


示例13: Next

        public override object Next(StateEntry entry, IProperty property)
        {
            Check.NotNull(entry, "entry");
            Check.NotNull(property, "property");

            return Guid.NewGuid();
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:GuidValueGenerator.cs


示例14: WrapProperty

 IProperty WrapProperty(IProperty result)
 {
     if (result == null) return null;
     if (!(result is AlienOwnedProperty))
         return new AlienOwnedProperty(this, _realMember, result);
     return result;
 }
开发者ID:dhootha,项目名称:openrasta-core,代码行数:7,代码来源:AlienMember.cs


示例15: ParameterDescriptorImpl

        public ParameterDescriptorImpl(IProperty property)
        {
            if (property == null) throw new ArgumentNullException("property");
            this.property = property;

            SetEnumerable();
        }
开发者ID:willrawls,项目名称:arp,代码行数:7,代码来源:ParameterDescriptorImpl.cs


示例16: GetValues

 public static IEnumerable<object> GetValues(IProperty property, bool isExploded = false)
 {
     if (isSimpleType(property.Type))
     {
         object result = property.Value;
         return new object[] { result };
     }
     else if (isListType(property.Type))
     {
         var result = (IEnumerable)property.Value;
         return result.Cast<object>().ToArray();
     }
     else
     {
         object instance = property.Value;
         var subProperties = PropertyLookup.CreatePropertyLookup(instance);
         List<object> values = new List<object>();
         foreach (IProperty subProperty in subProperties.GetProperties())
         {
             object value = subProperty.Value;
             if (isExploded)
             {
                 var pair = new Tuple<string, object>(subProperty.Name, value);
                 values.Add(pair);
             }
             else
             {
                 values.Add(subProperty.Name);
                 values.Add(value);
             }
         }
         return values.ToArray();
     }
 }
开发者ID:jehugaleahsa,项目名称:NRest,代码行数:34,代码来源:PropertyLookup.cs


示例17: GetIcon

		public static int GetIcon(IProperty property)
		{
			if (property.IsIndexer)
				return IndexerIndex + GetModifierOffset(property.Modifiers);
			else
				return PropertyIndex + GetModifierOffset(property.Modifiers);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:ClassBrowserIconService.cs


示例18: Select

        /// <summary>
        ///     Selects the appropriate value generator for a given property.
        /// </summary>
        /// <param name="property"> The property to get the value generator for. </param>
        /// <param name="entityType"> 
        ///     The entity type that the value generator will be used for. When called on inherited properties on derived entity types, 
        ///     this entity type may be different from the declared entity type on <paramref name="property" /> 
        /// </param>
        /// <returns> The value generator to be used. </returns>
        public virtual ValueGenerator Select(IProperty property, IEntityType entityType)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(entityType, nameof(entityType));

            return Cache.GetOrAdd(property, entityType, Create);
        }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:16,代码来源:ValueGeneratorSelector.cs


示例19: GetOrUpdateProperty

        protected static XElement GetOrUpdateProperty(XElement rootElement, IProperty property)
        {
            var propElem = rootElement.GetOrCreateElement("property", x => x.GetAttributeValue("name") == property.Name);
            propElem.SetAttributeValue("name", property.Name);      // todo: escape attribute values?

            var propertyValue = property.Value;
            if (propertyValue == null)
            {

            }
            else if (propertyValue is IXmlExportable)
            {
                var type = propertyValue.GetType();
                var typeString = type.FullName + ", " + type.Assembly.GetName().Name;

                var exportable = (IXmlExportable)propertyValue;
                propElem.SetAttributeValue("type", typeString);
                exportable.Export(propElem);
            }
            else
            {
                var value = propertyValue != null ? propertyValue.ToString() : null;
                propElem.SetAttributeValue("value", value);
            }
            return propElem;
        }
开发者ID:LazyTarget,项目名称:Lux,代码行数:26,代码来源:MirrorObjectXmlConvention.cs


示例20: MemberNode

		public MemberNode(IProperty property)
		{
			InitMemberNode(property);
			sortOrder = 12;
			Text = AppendReturnType(GetAmbience().Convert(property), property.ReturnType);
			SelectedImageIndex = ImageIndex = ClassBrowserIconService.GetIcon(property).ImageIndex;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:MemberNode.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IPropertyBag类代码示例发布时间:2022-05-24
下一篇:
C# IProperties类代码示例发布时间: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