Example #1
0
        /// <summary>
        /// Transforms an IVertex in a property definition.
        /// </summary>
        /// <param name="myVertex">A vertex that represents a property definition.</param>
        /// <returns>A property definition.</returns>
        public IPropertyDefinition CreatePropertyDefinition(IVertex myVertex, IBaseType myDefiningType = null)
        {
            var attributeID   = GetUUID(myVertex);
            var baseType      = GetBaseType(myVertex);
            var isMandatory   = GetIsMandatory(myVertex);
            var multiplicity  = GetPropertyMultiplicity(myVertex);
            var name          = GetAttributeDotName(myVertex);
            var defaultValue  = GetDefaultValue(myVertex, baseType);
            var definingType  = myDefiningType ?? GetDefiningType(myVertex);
            var inIndices     = GetInIndices(myVertex);
            var isUserDefined = GetAttributeDotIsUserDefined(myVertex);

            return(new PropertyDefinition
            {
                BaseType = baseType,
                IsMandatory = isMandatory,
                Multiplicity = multiplicity,
                Name = name,
                RelatedType = definingType,
                DefaultValue = defaultValue,
                InIndices = inIndices,
                ID = myVertex.VertexID,
                IsUserDefined = isUserDefined,
            });
        }
Example #2
0
            virtual public void ClearScriptObject()
            {
                if (mIsDestory)
                {
                    return;
                }
                mIsDestory = true;

                CallFunctionVoid("OnDestroy");

                if (mOnGUIDelegate != null)
                {
                    mOnGUIDelegate.Dispose();
                    mOnGUIDelegate = null;
                }
                if (mLateUpdateDelegate != null)
                {
                    mLateUpdateDelegate.Dispose();
                    mLateUpdateDelegate = null;
                }
                if (mFixedUpdateDelegate != null)
                {
                    mFixedUpdateDelegate.Dispose();
                    mFixedUpdateDelegate = null;
                }
                if (mUpdateDelegate != null)
                {
                    mUpdateDelegate.Dispose();
                    mUpdateDelegate = null;
                }

                mObject     = null;
                mScriptType = null;
                mCodeTool   = null;
            }
Example #3
0
 public ServiceBaseType(IBaseType myBaseType)
 {
     this.ID            = myBaseType.ID;
     this.Comment       = myBaseType.Comment;
     this.Name          = myBaseType.Name;
     this.IsUserDefined = myBaseType.IsUserDefined;
 }
Example #4
0
 public ServiceBaseType(IBaseType myBaseType)
 {
     this.ID = myBaseType.ID;
     this.Comment = myBaseType.Comment;
     this.Name = myBaseType.Name;
     this.IsUserDefined = myBaseType.IsUserDefined;
 }
Example #5
0
        override public K GetCSLEDelegate <K>(string _Function, IBaseType _classtype, object _target)
        {
            if (_classtype == null || _target == null)
            {
                return(default(K));
            }
            object    ret        = null;
            Method_CS methodctor = (Method_CS)GetLMethod(_classtype, _target, _Function, 0);

            if (methodctor == null)
            {
                return(default(K));
            }

            try
            {
                ret = Delegate.CreateDelegate(typeof(K), _target, methodctor.SMethod);
                return((K)ret);
            }
            catch (Exception _error)
            {
                DLog.LogErrorFormat("_classtype = {0},_Function = {1},error = {2}", _classtype.Name, _Function, _error);
                return(default(K));
            }
        }
Example #6
0
 override public object GetObject(IBaseType _type, params object[] _parmas)
 {
     if (_type == null)
     {
         throw new NullReferenceException("SYS GetCSLEObjectParmasByType _type = null");
     }
     return(Activator.CreateInstance(_type.TypeForCLR, _parmas));
 }
        public void DoSomething(IBaseType <BGenericType> parameter)
        {
            IBaseType <AGenericType> w1 = new BaseWhatever();

            w1.Field = parameter.Field; // automapper

            DoSomething(w1);
        }
 public def_BaseTypes(IBaseType c) : this()
 {
     if (c != null)
     {
         baseTypeId  = c.baseTypeId;
         enumeration = c.enumeration;
     }
 }
Example #9
0
 public bool IsDescendant(IBaseType myOtherType)
 {
     for (var current = RetrieveParentType(); current != null; current = current.RetrieveParentType())
     {
         if (current.Equals(myOtherType))
             return true;
     }
     return false;
 }
Example #10
0
        override public object GetTargetMemberByIndex(int _index, object _target)
        {
            if (_target == null)
            {
                return(null);
            }
            IBaseType ttype = GetObjectType(_target);

            return(GetMemberByIndex(ttype, _index, _target));
        }
Example #11
0
        override public object GetTargetMemberByKey(string _key, object _target)
        {
            if (_target == null)
            {
                return(null);
            }
            IBaseType ttype = GetObjectType(_target);

            return(GetMemberByKey(ttype, _key, _target));
        }
Example #12
0
        static void Main(string[] args)
        {
            var       baseObject = new BaseClass();
            IBaseType someObject = baseObject;

            someObject.FancyMethod();

            // Dekorujemy obiekt, przez co przy używaniu funkcji dodajemy nowe instrukcje
            someObject = new AnotherDecorator(new Decorator(baseObject));

            someObject.FancyMethod();
        }
Example #13
0
        private void CheckInjectableProperties(IBaseType baseObj)
        {
            var props = baseObj.ImplType.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance);

            foreach (var p in props)
            {
                if (p.IsDefined(typeof(Injectable), true))
                {
                    baseObj.InjectableProperties.Add(p);
                }
            }
        }
Example #14
0
 public static ServiceBaseType ToServiceBaseType(IBaseType myBaseType)
 {
     ServiceBaseType svcBaseType = null;
     if (myBaseType is IVertexType)
     {
         svcBaseType = new ServiceVertexType((IVertexType)myBaseType);
     }
     else if (myBaseType is IEdgeType)
     {
         svcBaseType = new ServiceEdgeType((IEdgeType)myBaseType);
     }
     return svcBaseType;
 }
Example #15
0
        public static ServiceBaseType ToServiceBaseType(IBaseType myBaseType)
        {
            ServiceBaseType svcBaseType = null;

            if (myBaseType is IVertexType)
            {
                svcBaseType = new ServiceVertexType((IVertexType)myBaseType);
            }
            else if (myBaseType is IEdgeType)
            {
                svcBaseType = new ServiceEdgeType((IEdgeType)myBaseType);
            }
            return(svcBaseType);
        }
Example #16
0
        internal static IBaseType ToBaseType(ServiceBaseType myBaseType, IServiceToken myServiceToken)
        {
            IBaseType result = null;

            if (myBaseType is ServiceVertexType)
            {
                result = new RemoteVertexType((ServiceVertexType)myBaseType, myServiceToken);
            }
            else if (myBaseType is ServiceEdgeType)
            {
                result = new RemoteEdgeType((ServiceEdgeType)myBaseType, myServiceToken);
            }
            return(result);
        }
Example #17
0
        override public void SetMember(IBaseType _type, string _key, object _object, object _target)
        {
            if (_type == null)
            {
                return;
            }
            FieldInfo pi = _type.TypeForCLR.GetField(_key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);

            if (pi == null)
            {
                throw new NullReferenceException("SYS SetMember pi = null ,_key = " + _key);
            }
            pi.SetValue(_target, _object);
        }
Example #18
0
        override public object GetMemberByKey(IBaseType _type, string _key, object _object)
        {
            if (_type == null)
            {
                throw new NullReferenceException("Base GetMember _type = null");
            }
            FieldInfo pi = _type.TypeForCLR.GetField(_key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);

            if (pi == null)
            {
                throw new NullReferenceException("Base GetMember FieldInfo pi = null");
            }
            return(pi.GetValue(_object));
        }
Example #19
0
        private void CheckSingleEdge(EdgePredefinition edge, IBaseType myTargetType)
        {
            if (edge.ContainedEdges != null)
            {
                //TODO better exception here.
                throw new Exception("A single edge can not contain other edges.");
            }

            if (edge.VertexIDsByVertexTypeID == null && edge.VertexIDsByVertexTypeName == null)
            {
                //TODO: better exception here
                throw new Exception("A single edge needs at least one target.");
            }

            ConvertUnknownProperties(edge, myTargetType);
        }
Example #20
0
        override public UpdateBase GetUpdateObjectAction(string _Function, string _classname, object _target)
        {
            IBaseType ttype = GetLType(_classname);

            if (ttype == null)
            {
                return(null);
            }
            Action tact = GetCSLEDelegate <Action>(_Function, ttype, _target);

            if (tact == null)
            {
                return(null);
            }
            return(new UpdateObject(string.Format("{0}->{1}", _classname, _Function), new Method_Action(tact), _target));
        }
Example #21
0
        private void CheckPostConstructsAndInjectableMethods(IBaseType baseObj)
        {
            var bindingFlags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
            var methods      = baseObj.ImplType.GetMethods(bindingFlags);

            foreach (var m in methods)
            {
                if (m.IsDefined(typeof(PostConstruct), true))
                {
                    baseObj.PostConstructs.Add(m);
                }
                else if (m.IsDefined(typeof(InjectableParams)))
                {
                    baseObj.InjectableMethods.Add(m);
                }
            }
        }
Example #22
0
        public static XmlSchemaSet GetSchema()
        {
            if (baseSchema != Fields.FieldsManager.FieldTypesXSD || generatedSchema == null)
            {
                baseSchema = Fields.FieldsManager.FieldTypesXSD;

                XmlSchemaSet s = new XmlSchemaSet();
                s.Add(baseSchema);

                XmlSchema sc  = new XmlSchema();
                XmlSchema sc2 = new XmlSchema();

                XmlSchemaElement sc2elm = new XmlSchemaElement();
                sc2elm.Name           = "TypesValue";
                sc2elm.SchemaTypeName = new XmlQualifiedName("Types");
                sc2.Items.Add(sc2elm);

                XmlSchemaComplexType sc2s = new XmlSchemaComplexType();
                sc2s.Name = "Types";
                sc2.Items.Add(sc2s);

                XmlSchemaChoice sc2ch = new XmlSchemaChoice();
                sc2s.Particle = sc2ch;


                foreach (var i in Fields.FieldsManager.FieldTypes)
                {
                    IBaseType fld = (IBaseType)Fields.FieldsManager.GetInstance(i);
                    fld.TypeName = i.Name + "0";
                    sc.Items.Add(fld.TypeSchema);
                }
                foreach (var i in Fields.FieldsManager.FieldTypes)
                {
                    XmlSchemaElement el = new XmlSchemaElement();
                    el.Name           = i.Name;
                    el.SchemaTypeName = new XmlQualifiedName(i.Name + "0");
                    sc2ch.Items.Add(el);
                }
                s.Add(sc);
                s.Add(sc2);
                s.Compile();

                generatedSchema = s;
            }
            return(generatedSchema);
        }
Example #23
0
        override public void SetMember(IBaseType _type, int _index, object _object, object _target)
        {
            if (_type == null)
            {
                return;
            }
            FieldInfo[] infos = _type.TypeForCLR.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            if (_index >= infos.Length)
            {
                throw new System.ArgumentNullException(string.Format("Base SetMember _index 越界 index = {0} Fieldinfo数组长度 = {1}", _index, infos.Length));
            }
            FieldInfo pi = infos[_index];

            if (pi == null)
            {
                throw new NullReferenceException("SYS SetMember pi = null ,_index = " + _index);
            }
            pi.SetValue(_target, _object);
        }
Example #24
0
        override public object GetMemberByIndex(IBaseType _type, int _index, object _object)
        {
            if (_type == null)
            {
                throw new NullReferenceException("Base GetMember _type = null");
            }
            FieldInfo[] infos = _type.TypeForCLR.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            if (_index >= infos.Length)
            {
                throw new System.ArgumentNullException(string.Format("Base GetMember _index 越界 index = {0} Fieldinfo数组长度 = ", _index, infos.Length));
            }
            FieldInfo pi = infos[_index];

            if (pi == null)
            {
                throw new NullReferenceException("Base GetMember FieldInfo pi = null");
            }
            return(pi.GetValue(_object));
        }
Example #25
0
 virtual protected void InitScriptOnAwake()
 {
     if (string.IsNullOrEmpty(mScriptClass) || mInitScript)
     {
         return;
     }
     try
     {
         mCodeTool   = GameCore.CodeTool;
         mScriptType = mCodeTool.GetLType(mScriptClass);
         mObject     = mCodeTool.GetObject(mScriptClass, this);
         InitParamList();
         InitInterface();
         mInitScript = true;
     }
     catch (Exception _erro)
     {
         DLog.LogError(string.Format("脚本初始化出错:Class = {0},GameObject = {1},InitScript ->{2}", mScriptClass, gameObject.name, _erro.ToString()));
     }
 }
Example #26
0
        public override bool EqualsTo(IBaseType value)
        {
            // If collection, compare each element
            if (value is AbstractCollection)
            {
                var thisList = AsEnumerable().ToList();
                var valueList = (value as AbstractCollection).AsEnumerable().ToList();
                if (thisList.Count != valueList.Count)
                {
                    return false;
                }
                for (int i = 0; i < thisList.Count; ++i)
                {
                    if (thisList[i].NotEqualsTo(valueList[i]))
                    {
                        return false;
                    }
                }
                return true;
            }

            // else compare by integer (which will mean size)
            return ToInt() == value.ToInt();
        }
Example #27
0
 public override bool IsDescendant(IBaseType myOtherType)
 {
     return((myOtherType is IEdgeType) ? _ServiceToken.EdgeTypeService.IsDescendantByEdgeType(_ServiceToken.SecurityToken, _ServiceToken.TransactionToken, new ServiceEdgeType(this), new ServiceEdgeType((IEdgeType)myOtherType)) : false);
 }
Example #28
0
        /// <summary>
        /// Transforms an IVertex in an incoming edge definition.
        /// </summary>
        /// <param name="myVertex">A vertex that represents an incoming edge definition.</param>
        /// <returns>An incoming edge definition.</returns>
        public IIncomingEdgeDefinition CreateIncomingEdgeDefinition(IVertex myVertex, IBaseType myDefiningType = null)
        {
            var attributeID   = GetUUID(myVertex);
            var name          = GetAttributeDotName(myVertex);
            var related       = GetRelatedOutgoingEdgeDefinition(myVertex);
            var definingType  = myDefiningType ?? GetDefiningType(myVertex);
            var isUserDefined = GetAttributeDotIsUserDefined(myVertex);

            return(new IncomingEdgeDefinition
            {
                Name = name,
                RelatedEdgeDefinition = related,
                RelatedType = definingType,
                ID = myVertex.VertexID,
                IsUserDefined = isUserDefined,
            });
        }
Example #29
0
 public IEnumerable <IPropertyDefinition> GetPropertiesFromFS(IVertex myTypeVertex, IBaseType myBaseType = null)
 {
     return(GetAttributeVertices(myTypeVertex, (long)BaseTypes.Property).Select(x => CreatePropertyDefinition(x, myBaseType)));
 }
Example #30
0
        private void CheckSingleEdge(EdgePredefinition edge, IBaseType myTargetType)
        {
            if (edge.ContainedEdges != null)
            {
                //TODO better exception here.
                throw new Exception("A single edge can not contain other edges.");
            }

            if (edge.VertexIDsByVertexTypeID == null && edge.VertexIDsByVertexTypeName == null)
                //TODO: better exception here
                throw new Exception("A single edge needs at least one target.");

            ConvertUnknownProperties(edge, myTargetType);
        }
Example #31
0
        private static void ConvertUnknownProperties(IPropertyProvider myPropertyProvider, IBaseType myBaseType)
        {
            if (myPropertyProvider.UnknownProperties != null)
            {
                foreach (var unknownProp in myPropertyProvider.UnknownProperties)
                {
                    //ASK: What's about binary properties?
                    if (myBaseType.HasProperty(unknownProp.Key))
                    {
                        var propDef = myBaseType.GetPropertyDefinition(unknownProp.Key);

                        try
                        {
                            var converted = unknownProp.Value.ConvertToIComparable(propDef.BaseType);
                            myPropertyProvider.AddStructuredProperty(unknownProp.Key, converted);
                        }
                        catch (InvalidCastException)
                        {
                            //TODO: better exception
                            throw new Exception("Type of property does not match.");
                        }
                    }
                    else
                    {
                        myPropertyProvider.AddUnstructuredProperty(unknownProp.Key, unknownProp.Value);
                    }
                }
                myPropertyProvider.ClearUnknown();
            }
        }
Example #32
0
 private static Dictionary<long, IComparable> ConvertStructuredProperties(IPropertyProvider myInsertDefinition, IBaseType myType)
 {
     return (myInsertDefinition.StructuredProperties == null)
                      ? null
                      : myInsertDefinition.StructuredProperties.ToDictionary(x => myType.GetAttributeDefinition(x.Key).ID, x => x.Value);
 }
Example #33
0
        protected static void ConvertUnknownProperties(IPropertyProvider myPropertyProvider,
                                                       IBaseType myBaseType)
        {
            if (myPropertyProvider.UnknownProperties != null)
            {
                foreach (var unknownProp in myPropertyProvider.UnknownProperties)
                {
                    //ASK: What's about binary properties?
                    if (myBaseType.HasProperty(unknownProp.Key))
                    {
                        var propDef = myBaseType.GetPropertyDefinition(unknownProp.Key);

                        try
                        {
                            IComparable converted = null;

                            if (propDef.Multiplicity == PropertyMultiplicity.List ||
                                propDef.Multiplicity == PropertyMultiplicity.Set)
                            {
                                converted = unknownProp.Value.ConvertToIComparableList(propDef.BaseType);
                            }
                            else
                            {
                                if (propDef.BaseType.IsSubclassOf(typeof(AUserdefinedDataType)))
                                {
                                    var userdefType = (AUserdefinedDataType)Activator.CreateInstance(propDef.BaseType, new object[] { unknownProp.Value.ConvertToIComparable(typeof(String)) as String });

                                    if (userdefType != null)
                                    {
                                        converted = userdefType;
                                    }
                                }
                                else
                                {
                                    converted = unknownProp.Value.ConvertToIComparable(propDef.BaseType);
                                }
                            }

                            myPropertyProvider.AddStructuredProperty(unknownProp.Key, converted);
                        }
                        catch (InvalidCastException)
                        {
                            //TODO: better exception
                            throw new Exception("Type of property does not match.");
                        }
                    }
                    else
                    {
                        IComparable converted = null;

                        try
                        {
                            if (unknownProp.Value is IEnumerable <Object> )
                            {
                                if (((IEnumerable <Object>)unknownProp.Value).Count() > 1)
                                {
                                    converted = unknownProp.Value.ConvertToIComparableList(typeof(object));
                                }
                                else
                                {
                                    converted = unknownProp.Value.ConvertToIComparable(typeof(object));
                                }
                            }
                            else
                            {
                                converted = unknownProp.Value.ConvertToIComparable(typeof(object));
                            }

                            myPropertyProvider.AddUnstructuredProperty(unknownProp.Key, converted);
                        }
                        catch (InvalidCastException)
                        {
                            myPropertyProvider.AddUnstructuredProperty(unknownProp.Key, unknownProp.Value);
                        }
                    }
                }
                myPropertyProvider.ClearUnknown();
            }
        }
 public TestFactory(IBaseType type) {
 }
Example #35
0
        public override bool EqualsTo(IBaseType value)
        {
            var otherQueueRep = value.ToPriorityQueue().rep;

            var leftIter = rep.GetEnumerator();
            var rightIter = otherQueueRep.GetEnumerator();

            bool leftOver = false;
            bool rightOver = false;

            while ((leftOver = leftIter.MoveNext()) && (rightOver = rightIter.MoveNext()))
            {
                if (!leftIter.Current.Equals(rightIter.Current))
                {
                    return false;
                }
                leftOver = rightOver = false;
            }

            if (leftOver || rightOver)
            {
                return false;
            }
            return true;
        }
Example #36
0
        protected static void ConvertUnknownProperties(IPropertyProvider myPropertyProvider,
                                                        IBaseType myBaseType)
        {
            if (myPropertyProvider.UnknownProperties != null)
            {
                foreach (var unknownProp in myPropertyProvider.UnknownProperties)
                {
                    //ASK: What's about binary properties?
                    if (myBaseType.HasProperty(unknownProp.Key))
                    {
                        var propDef = myBaseType.GetPropertyDefinition(unknownProp.Key);

                        try
                        {
                            IComparable converted = null;

                            if (propDef.Multiplicity == PropertyMultiplicity.List ||
                                propDef.Multiplicity == PropertyMultiplicity.Set)
                                converted = unknownProp.Value.ConvertToIComparableList(propDef.BaseType);
                            else
                                converted = unknownProp.Value.ConvertToIComparable(propDef.BaseType);

                            myPropertyProvider.AddStructuredProperty(unknownProp.Key, converted);
                        }
                        catch (InvalidCastException)
                        {
                            //TODO: better exception
                            throw new Exception("Type of property does not match.");
                        }
                    }
                    else
                    {
                        IComparable converted = null;

                        try
                        {
                            if (unknownProp.Value is IEnumerable<Object>)
                                if (((IEnumerable<Object>)unknownProp.Value).Count() > 1)
                                    converted = unknownProp.Value.ConvertToIComparableList(typeof(object));
                                else
                                    converted = unknownProp.Value.ConvertToIComparable(typeof(object));
                            else
                                converted = unknownProp.Value.ConvertToIComparable(typeof(object));

                            myPropertyProvider.AddUnstructuredProperty(unknownProp.Key, converted);
                        }
                        catch (InvalidCastException)
                        {
                            myPropertyProvider.AddUnstructuredProperty(unknownProp.Key, unknownProp.Value);
                        }
                    }
                }
                myPropertyProvider.ClearUnknown();
            }
        }
Example #37
0
        protected void CheckMandatoryConstraint(IPropertyProvider myPropertyProvider, IBaseType myType)
        {
            var mandatories = myType.GetPropertyDefinitions(true).Where(IsMustSetProperty).ToArray();

            foreach (var mand in mandatories)
            {
                if (myPropertyProvider == null || myPropertyProvider.StructuredProperties == null ||
                    !myPropertyProvider.StructuredProperties.Any(x => mand.Name.Equals(x.Key)))
                {
                    throw new MandatoryConstraintViolationException(mand.Name);
                }
            }
        }
Example #38
0
        /// <summary>
        /// Transforms an IVertex in a property definition.
        /// </summary>
        /// <param name="myVertex">A vertex that represents a property definition.</param>
        /// <returns>A property definition.</returns>
        public static IPropertyDefinition CreatePropertyDefinition(IVertex myVertex, IBaseType myDefiningType = null)
        {
            var attributeID = GetUUID(myVertex);
            var baseType = GetBaseType(myVertex);
            var isMandatory = GetIsMandatory(myVertex);
            var multiplicity = GetPropertyMultiplicity(myVertex);
            var name = GetAttributeDotName(myVertex);
            var defaultValue = GetDefaultValue(myVertex, baseType);
            var definingType = myDefiningType ?? GetDefiningType(myVertex);
            var inIndices = GetInIndices(myVertex);
            var isUserDefined = GetAttributeDotIsUserDefined(myVertex);

            return new PropertyDefinition
            {
                BaseType = baseType,
                IsMandatory = isMandatory,
                Multiplicity = multiplicity,
                Name = name,
                RelatedType = definingType,
                DefaultValue = defaultValue,
                InIndices = inIndices,
                ID = myVertex.VertexID,
                IsUserDefined = isUserDefined,
            };
        }
 public override IVertexView CreateResult(IBaseType myAlteredType)
 {
     throw new NotImplementedException();
 }
Example #40
0
 /// <summary>
 /// Creates the result of altering a type
 /// </summary>
 /// <param name="myAlteredVertexType">The type that has been altered</param>
 /// <returns>A vertex view</returns>
 public abstract IVertexView CreateResult(IBaseType myAlteredType);
Example #41
0
        public override bool EqualsTo(IBaseType value)
        {
            if (value == null)
                return false;

            if (value.GetType() != typeof(Struct))
                return false;

            if (!StructuralEquals(value as Struct))
                return false;

            foreach (var item in (value as Struct).Attributes)
                if (!item.Value.Value.EqualsTo(Attributes[item.Key].Value))
                    return false;

            return true;
        }
Example #42
0
        /// <summary>
        /// Transforms an IVertex in an incoming edge definition.
        /// </summary>
        /// <param name="myVertex">A vertex that represents an incoming edge definition.</param>
        /// <returns>An incoming edge definition.</returns>
        public static IIncomingEdgeDefinition CreateIncomingEdgeDefinition(IVertex myVertex, IBaseType myDefiningType = null)
        {
            var attributeID = GetUUID(myVertex);
            var name = GetAttributeDotName(myVertex);
            var related = GetRelatedOutgoingEdgeDefinition(myVertex);
            var definingType = myDefiningType ?? GetDefiningType(myVertex);
            var isUserDefined = GetAttributeDotIsUserDefined(myVertex);

            return new IncomingEdgeDefinition
            {
                Name = name,
                RelatedEdgeDefinition = related,
                RelatedType = definingType,
                ID = myVertex.VertexID,
                IsUserDefined = isUserDefined,
            };
        }
Example #43
0
        protected void CheckMandatoryConstraint(IPropertyProvider myPropertyProvider, IBaseType myType)
        {
            var mandatories = myType.GetPropertyDefinitions(true).Where(IsMustSetProperty).ToArray();

            foreach (var mand in mandatories)
            {
                if (myPropertyProvider == null || myPropertyProvider.StructuredProperties == null ||
                    !myPropertyProvider.StructuredProperties.Any(x => mand.Name.Equals(x.Key)))
                {
                    throw new MandatoryConstraintViolationException(mand.Name);
                }
            }
        }
Example #44
0
        /// <summary>
        /// Check for default values.
        /// If a default value is set for the property, than we add this to the insert definition.
        /// </summary>
        /// <param name="myPropertyProvider">The insert definition.</param>
        /// <param name="myBaseType">The vertex type, which is to be updated.</param>
        private static void ConvertDefaultValues(IPropertyProvider myPropertyProvider, IBaseType myBaseType)
        {
            if (myPropertyProvider.StructuredProperties != null)
            {
                var checkForDefaultValues = myBaseType.GetPropertyDefinitions(true).Where(item => !myPropertyProvider.StructuredProperties.ContainsKey(item.Name)).Where(_ => _.DefaultValue != null);

                foreach (var item in checkForDefaultValues)
                {
                    myPropertyProvider.AddStructuredProperty(item.Name, item.DefaultValue);
                }
            }
        }
Example #45
0
 public override bool IsDescendantOrSelf(IBaseType myOtherType)
 {
     return((myOtherType is IVertexType) ? _ServiceToken.VertexTypeService.IsDescendantOrSelfByVertexType(_ServiceToken.SecurityToken, _ServiceToken.TransactionToken, new ServiceVertexType(this), new ServiceVertexType((IVertexType)myOtherType)) : false);
 }
Example #46
0
 public override bool EqualsTo(IBaseType value)
 {
     return referencedValue.EqualsTo(value);
 }
Example #47
0
 public static IEnumerable<IPropertyDefinition> GetPropertiesFromFS(IVertex myTypeVertex, IBaseType myBaseType = null)
 {
     return GetAttributeVertices(myTypeVertex, (long)BaseTypes.Property).Select(x => CreatePropertyDefinition(x, myBaseType));
 }
Example #48
0
 public override bool EqualsTo(IBaseType value)
 {
     return value.ToNull().IsNull;
 }
Example #49
0
        private StructuredPropertiesUpdate CreateStructuredUpdate(IDictionary<string, IComparable> myStructured, IBaseType myVertexType)
        {
            if (myStructured == null)
                return null;

            return new StructuredPropertiesUpdate(myStructured.ToDictionary(_ => myVertexType.GetAttributeDefinition(_.Key).ID, _ => _.Value));
        }
Example #50
0
		public override bool IsDescendant(IBaseType myOtherType)
		{
            return (myOtherType is IEdgeType) ? _ServiceToken.EdgeTypeService.IsDescendantByEdgeType(_ServiceToken.SecurityToken, _ServiceToken.TransactionToken, new ServiceEdgeType(this), new ServiceEdgeType((IEdgeType)myOtherType)) : false;
		}
 public override IVertexView CreateResult(IBaseType myAlteredType)
 {
     throw new NotImplementedException();
 }
Example #52
0
 public override bool IsDescendantOrSelf(IBaseType myOtherType)
 {
     return (myOtherType is IVertexType) ? _ServiceToken.VertexTypeService.IsDescendantOrSelfByVertexType(_ServiceToken.SecurityToken, _ServiceToken.TransactionToken, new ServiceVertexType(this), new ServiceVertexType((IVertexType)myOtherType)) : false;
 }