private string CSharpName(MetaCollectionType mtype, MetaModel mmodel, ClassKind kind = ClassKind.None, bool fullName = false)
        {
            string result = this.CSharpName(mtype.InnerType, mmodel, kind, fullName);

            if (kind == ClassKind.BuilderOperation || kind == ClassKind.ImmutableOperation)
            {
                if (mtype.Kind == MetaCollectionKind.List || mtype.Kind == MetaCollectionKind.MultiList)
                {
                    return("global::System.Collections.Generic.IReadOnlyList<" + result + ">");
                }
                else
                {
                    return("global::System.Collections.Generic.IReadOnlyCollection<" + result + ">");
                }
            }
            string collectionName;

            switch (mtype.Kind)
            {
            case MetaCollectionKind.List:
            case MetaCollectionKind.MultiList:
                if (kind == ClassKind.Builder)
                {
                    collectionName = "MutableModelList";
                }
                else
                {
                    collectionName = "ImmutableModelList";
                }
                break;

            case MetaCollectionKind.Set:
            case MetaCollectionKind.MultiSet:
                if (kind == ClassKind.Builder)
                {
                    collectionName = "MutableModelSet";
                }
                else
                {
                    collectionName = "ImmutableModelSet";
                }
                break;

            default:
                collectionName = "";
                break;
            }
            result = _generator.Properties.CoreNs + "." + collectionName + "<" + result + ">";
            return(result);
        }
예제 #2
0
파일: MetaModel.cs 프로젝트: Bubesz/meta-cs
     /// <summary>
 	/// Implements the constructor: MetaCollectionType()
 	/// Direct superclasses: global::MetaDslx.Core.MetaType
 	/// All superclasses: global::MetaDslx.Core.MetaType
     /// </summary>
     public virtual void MetaCollectionType(MetaCollectionType @this)
     {
         this.MetaType(@this);
     }