/// <summary>
        /// Constructor that takes the metadata context, a metadata type and a parent custom type descriptor
        /// </summary>
        /// <param name="typeDescriptionContext">The <see cref="LinqToSqlTypeDescriptionContext"/> context.</param>
        /// <param name="metaType">The <see cref="MetaType"/> type.</param>
        /// <param name="parent">The parent custom type descriptor.</param>
        public LinqToSqlTypeDescriptor(LinqToSqlTypeDescriptionContext typeDescriptionContext, MetaType metaType, ICustomTypeDescriptor parent)
            : base(parent)
        {
            this._typeDescriptionContext = typeDescriptionContext;
            this._metaType = metaType;

            // if any FK member of any association is also part of the primary key, then the key cannot be marked
            // Editable(false)
            this._keyIsEditable = this._metaType.Associations.Any(p => p.IsForeignKey && p.ThisKey.Any(q => q.IsPrimaryKey));
        }
        /// <summary>
        /// Constructor that takes the metadata context, a metadata type and a parent custom type descriptor
        /// </summary>
        /// <param name="typeDescriptionContext">The <see cref="LinqToSqlTypeDescriptionContext"/> context.</param>
        /// <param name="metaType">The <see cref="MetaType"/> type.</param>
        /// <param name="parent">The parent custom type descriptor.</param>
        public LinqToSqlTypeDescriptor(LinqToSqlTypeDescriptionContext typeDescriptionContext, MetaType metaType, ICustomTypeDescriptor parent)
            : base(parent)
        {
            this._typeDescriptionContext = typeDescriptionContext;
            this._metaType = metaType;

            // if any FK member of any association is also part of the primary key, then the key cannot be marked
            // Editable(false)
            this._keyIsEditable = this._metaType.Associations.Any(p => p.IsForeignKey && p.ThisKey.Any(q => q.IsPrimaryKey));
        }
Esempio n. 3
0
 public LinqToSqlDomainServiceDescriptionProvider(Type domainServiceType, Type dataContextType, DomainServiceDescriptionProvider parent)
     : base(domainServiceType, parent)
 {
     lock (tdpContextMap)
     {
         if (!tdpContextMap.TryGetValue(dataContextType, out this._typeDescriptionContext))
         {
             // create and cache a context for this provider type
             this._typeDescriptionContext = new LinqToSqlTypeDescriptionContext(dataContextType);
             tdpContextMap.Add(dataContextType, this._typeDescriptionContext);
         }
     }
 }
 public LinqToSqlDomainServiceDescriptionProvider(Type domainServiceType, Type dataContextType, DomainServiceDescriptionProvider parent)
     : base(domainServiceType, parent)
 {
     lock (tdpContextMap)
     {
         if (!tdpContextMap.TryGetValue(dataContextType, out this._typeDescriptionContext))
         {
             // create and cache a context for this provider type
             this._typeDescriptionContext = new LinqToSqlTypeDescriptionContext(dataContextType);
             tdpContextMap.Add(dataContextType, this._typeDescriptionContext);
         }
     }
 }