示例#1
0
        public static Guid GetId(object instance)
        {
            var shadow = ShadowObject.GetShadow(instance);

            if (shadow == null)
            {
                return(Guid.Empty);
            }
            return(shadow.GetId(instance));
        }
示例#2
0
文件: Override.cs 项目: joewan/xenko
        /// <summary>
        /// Remove all overrides information attached to an instance (Note that this method is not recursive and must be applied on all object).
        /// </summary>
        /// <param name="instance">An object instance</param>
        public static void RemoveFrom(object instance)
        {
            if (instance == null) throw new ArgumentNullException(nameof(instance));
            var shadow = ShadowObject.GetShadow(instance);
            if (shadow == null)
            {
                return;
            }

            // Remove override information from an object
            foreach (var attributes in shadow.Members)
            {
                attributes.Attributes.Remove(OverrideKey);
            }
        }
示例#3
0
        public static void SetId(object instance, Guid id)
        {
            var shadow = ShadowObject.GetShadow(instance);

            shadow?.SetId(instance, id);
        }