DumpObjectProperties() публичный статический Метод

Public method used to dump object on console. This method uses the private method dumpObjectOnString
public static DumpObjectProperties ( Object obj ) : void
obj Object Object to dump
Результат void
Пример #1
0
        /// <summary>
        /// This method shows the use and the functionality of some repository methods.
        /// <c>
        /// Insert a new Track in the Database, Count all elements and the Load it all! Then delete a item and Load it all again
        /// </c>
        /// </summary>
        public static void InsertCountLoadAllDeleteAndLoadAgain()
        {
            ExampleHelper.ExampleMethodPrint("Insert a new Track in the Database, Count all elements and the Load it all!\n" +
                                             "Then delete a item and Load it all again", MethodInfo.GetCurrentMethod());
            TrackModel track = new TrackModel(@"..\..\Resource\Garden.mp3");

            ExampleHelper.DumpObjectProperties(track.GetAsDatabaseType());
            Console.WriteLine("Save Response : " + _trackRep.Save(track));
            Console.WriteLine("Count : " + _trackRep.Count <TrackModel.Track>());
            List <TrackModel.Track> list = new List <TrackModel.Track>();

            Console.WriteLine("GetAll Response : " + _trackRep.GetAll(list));
            foreach (TrackModel.Track t in list)
            {
                ExampleHelper.DumpObjectProperties(t);
            }
            TrackModel anotherTrack = new TrackModel();

            Console.WriteLine("Delete Response: " + _trackRep.Delete <TrackModel.Track>(list.First().Id));
            list.Clear();
            Console.WriteLine("GetAll Response : " + _trackRep.GetAll(list));
            foreach (TrackModel.Track t in list)
            {
                ExampleHelper.DumpObjectProperties(t);
            }
        }
        /// <summary>
        /// This example shows how to refreash a resource inside the repository.
        /// </summary>
        public static void RefreshExample()
        {
            ExampleHelper.ExampleMethodPrint("Refresh a previously loaded tag", MethodInfo.GetCurrentMethod());
            _repository.RefreshResource(tag.TagHash, new Uri("http://localhost:18292"), DateTime.Now.AddHours(1));
            KademliaResource rs = _repository.Get(tag.TagHash);

            ExampleHelper.DumpObjectProperties(rs);
        }
Пример #3
0
        /// <summary>
        /// This example shows how to save a track in a generic repository
        /// </summary>
        public static void StoreTrackInDb()
        {
            ExampleHelper.ExampleMethodPrint("Create a TrackModel from file and store it in the database", MethodInfo.GetCurrentMethod());
            TrackModel track = new TrackModel("..\\..\\Resource\\SevenMP3.mp3");

            _hid = track.GetAsDatabaseType().Id;
            ExampleHelper.DumpObjectProperties(track.GetAsDatabaseType());
            Console.WriteLine("Response : " + _trackRep.Save(track));
        }
        /// <summary>
        /// This example show how to perform research inside the repository
        /// </summary>
        public static void SearchExample()
        {
            ExampleHelper.ExampleMethodPrint("Trying to Search for Tags with a search Query", MethodInfo.GetCurrentMethod());
            string query = "cross";

            KademliaResource[] results = _repository.SearchFor(query);
            foreach (KademliaResource rs in results)
            {
                ExampleHelper.DumpObjectProperties(rs);
            }
        }
        /// <summary>
        /// This example use the <c>GetAll</c> method to show all object contained in the repository
        /// </summary>
        private static void GetAllExample()
        {
            ExampleHelper.ExampleMethodPrint("Print all KademliaResource in the repository", MethodInfo.GetCurrentMethod());
            LinkedList <KademliaResource> coll = _repository.GetAllElements();

            foreach (KademliaResource res in coll)
            {
                ExampleHelper.DumpObjectProperties(res);
                Console.WriteLine();
            }
        }
Пример #6
0
        /// <summary>
        /// This example shows how to load from the repository a previously stored track.
        /// </summary>
        public static void LoadTrackFromDb()
        {
            ExampleHelper.ExampleMethodPrint("Load a TrackModel from the database", MethodInfo.GetCurrentMethod());
            TrackModel         track = new TrackModel();
            RepositoryResponse resp  = _trackRep.GetByKey <TrackModel.Track>(_hid, track);

            Console.WriteLine("Response : " + resp);
            if (resp >= 0)
            {
                ExampleHelper.DumpObjectProperties(track.GetAsDatabaseType());
            }
        }