Example #1
0
 /// <summary>
 /// Unregisters a previously-registered sub-class of <see cref="ParseObject"/> with the subclassing controller.
 /// </summary>
 /// <param name="subclassingController"></param>
 /// <param name="type"></param>
 public static void RemoveClass(this IParseObjectClassController subclassingController, Type type)
 {
     if (typeof(ParseObject).IsAssignableFrom(type))
     {
         subclassingController.RemoveClass(type);
     }
 }
 public ParseCurrentInstallationController(IParseInstallationController installationIdController, ICacheController storageController, IParseInstallationCoder installationCoder, IParseObjectClassController classController)
 {
     InstallationController = installationIdController;
     StorageController      = storageController;
     InstallationCoder      = installationCoder;
     ClassController        = classController;
 }
Example #3
0
        /// <summary>
        /// Creates a reference to an existing ParseObject for use in creating associations between
        /// ParseObjects. Calling <see cref="IsDataAvailable"/> on this object will return
        /// <c>false</c> until <see cref="ParseExtensions.FetchIfNeededAsync{T}(T)"/> has been called.
        /// No network request will be made.
        /// </summary>
        /// <param name="className">The object's class.</param>
        /// <param name="objectId">The object id for the referenced object.</param>
        /// <returns>A ParseObject without data.</returns>
        public static ParseObject CreateObjectWithoutData(this IParseObjectClassController classController, string className, string objectId, IServiceHub serviceHub)
        {
            ParseObject.CreatingPointer.Value = true;
            try
            {
                ParseObject result = classController.Instantiate(className, serviceHub);
                result.ObjectId = objectId;

                // Left in because the property setter might be doing something funky.

                result.IsDirty = false;
                return(result.IsDirty ? throw new InvalidOperationException("A ParseObject subclass default constructor must not make changes to the object that cause it to be dirty.") : result);
            }
            finally { ParseObject.CreatingPointer.Value = false; }
        }
Example #4
0
 public ParseCurrentUserController(ICacheController storageController, IParseObjectClassController classController, IParseDataDecoder decoder) => (StorageController, ClassController, Decoder) = (storageController, classController, decoder);
Example #5
0
 ParseRelationOperation(IParseObjectClassController classController) => ClassController = classController;
Example #6
0
        internal static ParseRelationBase CreateRelation(this IParseObjectClassController classController, ParseObject parent, string key, string targetClassName)
        {
            Expression <Func <ParseRelation <ParseObject> > > createRelationExpr = () => CreateRelation <ParseObject>(parent, key, targetClassName);

            return((createRelationExpr.Body as MethodCallExpression).Method.GetGenericMethodDefinition().MakeGenericMethod(classController.GetType(targetClassName) ?? typeof(ParseObject)).Invoke(default, new object[] { parent, key, targetClassName }) as ParseRelationBase);
Example #7
0
 public ParseInstallationCoder(IParseDataDecoder decoder, IParseObjectClassController classController) => (Decoder, ClassController) = (decoder, classController);
 public ParseDataDecoder(IParseObjectClassController classController) => ClassController = classController;
Example #9
0
 /// <summary>
 /// Creates a new ParseObject based upon a given subclass type.
 /// </summary>
 /// <returns>A new ParseObject for the given class name.</returns>
 public static T CreateObject <T>(this IParseObjectClassController classController, IServiceHub serviceHub) where T : ParseObject => (T)classController.Instantiate(classController.GetClassName(typeof(T)), serviceHub);