Пример #1
0
        EntityIndexData createEntityIndexData(Type type, List <PublicMemberInfo> infos)
        {
            var data = new EntityIndexData();

            var info      = infos.Single(i => i.attributes.Count(attr => attr.attribute is AbstractEntityIndexAttribute) == 1);
            var attribute = (AbstractEntityIndexAttribute)info.attributes.Single(attr => attr.attribute is AbstractEntityIndexAttribute).attribute;

            data.SetEntityIndexType(getEntityIndexType(attribute));
            data.IsCustom(false);
            data.SetEntityIndexName(type.ToCompilableString().RemoveComponentSuffix().RemoveDots());
            data.SetKeyType(info.type.ToCompilableString());
            data.SetComponentType(type.ToCompilableString());
            data.SetComponentName(type.ToCompilableString().ShortTypeName().RemoveComponentSuffix());
            data.SetMemberName(info.name);

            var contextNames = ContextsComponentDataProvider.GetContextNames(type);

            if (contextNames.Length == 0)
            {
                contextNames = new [] { _defaultContextName };
            }
            data.SetContextNames(contextNames);

            return(data);
        }
 bool hasContexts(Type type)
 {
     return(ContextsComponentDataProvider.GetContextNames(type).Length != 0);
 }