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


C# IProperty类代码示例

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


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


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