예제 #1
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Gets or try to create property.
        /// </summary>
        /// <exception cref="Exception">
        ///  Thrown when an exception error condition occurs.
        /// </exception>
        /// <param name="propertyName">
        ///  Name of the property.
        /// </param>
        /// <param name="type">
        ///  The type.
        /// </param>
        /// <returns>
        ///  The or try to create property.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        protected ISchemaProperty GetOrTryToCreateProperty(string propertyName, Type type)
        {
            DebugContract.RequiresNotEmpty(propertyName, "protectedName");
            DebugContract.Requires(type, "type");

            var propertyMetadata = ((IModelElement)this).SchemaInfo.GetProperty(propertyName);

            if (propertyMetadata == null)
            {
                //Session.Current.AcquireLock(LockType.ExclusiveWait, String.Format("{0}.{1}", Metadata.Id, propertyName));
                //propertyMetadata = Metadata.GetProperty(propertyName);
                //if (propertyMetadata == null)
                //{
                //    var pmetadata = Store.GetMetadata(typeName) as IMetaValue;
                //    if (pmetadata == null)
                //        throw new Exception("Unknow meta value type " + typeName);

                //    propertyMetadata = new MetaProperty(Metadata, propertyName, pmetadata);
                //    Metadata.DefineProperty(propertyMetadata);
                //}
                throw new PropertyDefinitionException(string.Format(ExceptionMessages.UnknownPropertyFormat, propertyName));
            }

            return(propertyMetadata);
        }
예제 #2
0
        void IPropertyChangedNotifier.NotifyPropertyChanged(string propertyName)
        {
            DebugContract.RequiresNotEmpty(propertyName);
            var tmp = PropertyChanged;

            if (tmp != null)
            {
                tmp(this, new PropertyChangedEventArgs(propertyName));
            }
        }
예제 #3
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Initializes a new instance of the <see cref="DiagnosticMessage"/> class.
        /// </summary>
        /// <param name="messageType">
        ///  Type of the message.
        /// </param>
        /// <param name="message">
        ///  The message.
        /// </param>
        /// <param name="category">
        ///  The category.
        /// </param>
        /// <param name="modelElement">
        ///  (Optional) The model element.
        /// </param>
        /// <param name="ex">
        ///  (Optional) The ex.
        /// </param>
        /// <param name="propertyName">
        ///  (Optional) The name of the property.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        public DiagnosticMessage(MessageType messageType, string message, string category, IModelElement modelElement = null, Exception ex = null, string propertyName = null)
        {
            DebugContract.RequiresNotEmpty(message);

            MessageType  = messageType;
            Message      = message;
            Category     = category;
            Element      = modelElement;
            Exception    = ex;
            PropertyName = propertyName;
        }
예제 #4
0
        internal static Tuple <string, string> SplitFullName(string name)
        {
            DebugContract.RequiresNotEmpty(name);

            var pos = name.LastIndexOf('.');

            if (pos < 0)
            {
                return(Tuple.Create(String.Empty, name));
            }

            return(Tuple.Create(name.Substring(0, pos), name.Substring(pos + 1)));
        }
예제 #5
0
 public CalculatedProperty(string propertyName)
 {
     DebugContract.RequiresNotEmpty(propertyName);
     PropertyName = propertyName;
 }
예제 #6
0
 internal DiagnosticMessage(MessageType messageType, string message, string category, bool isConstraintMessage, IModelElement modelElement = null, Exception ex = null, string propertyName = null)
     : this(messageType, message, category, modelElement, ex, propertyName)
 {
     DebugContract.RequiresNotEmpty(message);
     IsConstraintMessage = isConstraintMessage;
 }