Querying with Views

Coordinator
Dec 2, 2010 at 12:17 AM
Edited Dec 2, 2010 at 12:21 AM

Hi Pratik,

I've checked in the initial view implementation, it possibly has a few bugs and still needs some work and some more tests but it would be great to see what you think.

It promotes using a MVVM style pattern.

At the moment there is no synchronisation method so it assumes you are starting from zero data (i.e that you do not need to create views from existing data already within the phone, so would work if using the emulator or a fresh install on a real phone).

This is a basic overview of how to use.

Create a View class with just the properties you need for a specific view.

For example if you have a MyPhoto class with a Name, date added and a byte[] Image and you have a page that just displays the Name, date added and a button to open the image. the view would look something like:

 

public class MyPhotoNamesView : IRapidView
{
    public Guid Id {get; set;}
    public string Name {get;set;}
    public DateTime DateAdded {get;set;}
}

On your repository at application start add the view by mapping the properties from your entity to the view.

MyPhotoRepository.AddView<MyPhotoNamesView>(x => new MyPhotoNamesView { Name = x.Name, DateAdded = x.DateAdded });

You can also add a filter (or multiple filters using the fluent syntax) if for say you only want to ever show photos for the last 10 days.

MyPhotoRepository.AddView<MyPhotoNamesView>(x => new MyPhotoNamesView { Name = x.Name, DateAdded = x.DateAdded })
.AddFilter(x => x.DateAdded > DateTime.Now.AddDays(-10));

To query the data, you call the query method on the the repository, you can do further linq on the result set if required.

 

MyPhotoRepository repository = new MyPhotoRepository();
List<MyPhotoNamesView> results = repository.Query<MyPhotoNamesView>().Where(x => x.Name.StartsWith("MyVariable").ToList();

 

IMPORTANT

The Id of the view items is the same as the id of the corresponding entity so if you attach the view Id to the button, you can then call repository.GetById(viewId) and the actual full entity will be returned, you can then display the image.

I hope this makes sense and you like it.

Let me know any bugs you come across.

Kind Regards,

Sean.

Dec 2, 2010 at 3:11 PM

Sean,

I will try this out a little later today and get back to you.

Pratik

Dec 3, 2010 at 2:55 PM

I think I posted this on the other thread.  I am re-posting it here.  Let me know if you didn't receive the attachment of my sample code.

I haven’t gotten to this yet.  I am stuck on a different issue involving storage of the photo from a camera

Please try the following on an actual device and not the emulator as the emulate camera images are too small in size.  Also, you will have to disconnect Zune as there are some issues. You can use the WPConnect tool as mentioned here while debugging from the device. http://blogs.msdn.com/b/katriend/archive/2010/10/26/quick-tip-using-the-wp-connect-utility-instead-of-zune-client-windows-phone-7.aspx 

While trying to save a record with a photo taken from the camera (photo size around 1.2 Mb), the code runs extremely slow (take around 8-10 seconds or more sometimes and app gets killed by the OS)

Please see the attached sample code and if you can help me figure out the issue, that will be great.

 

I have modified your TestMobileApplication sample to generate the same issue. Here are the modifications: 

Added a Photo.cs to the Entities folder and an instance is contained inside the Customer class as a property.

AddCustomer.xaml – added two new buttons Camera, Gallery at the bottom that implement CameraCaptureTask and PhotoChooserTask respectively.

 

The following event handler inside AddCustomer.xaml.cs stores the chosen photo in the Photo property of Customer and during save, this data is written to the IsolatedStorage using RapidRepository (it seems that during Serialize() method of the Serializer class, it is taking a long time – during writing and retrieval)

        /// <summary>
        /// Event handler for the CameraCapture or the PhotoChooser task. This event handler sets the properties
        /// for the Photo instance of this entry.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PhotoProviderTaskCompleted(object sender, PhotoResult e)
        {
            // Load the photo from the task result
            if (e != null && e.TaskResult == TaskResult.OK)
            {
                var imageBits = new byte[(int)e.ChosenPhoto.Length];
                e.ChosenPhoto.Read(imageBits, 0, imageBits.Length);
                e.ChosenPhoto.Seek(0, System.IO.SeekOrigin.Begin);

                var name = String.Format("MS_{0:yyyy-MM-dd_hh-mm-ss-tt}.jpg"DateTime.Now);

                if (customer.Photo != null)
                {
                    customer.Photo.FileName = name;
                    customer.Photo.FileContentAsBytes = imageBits;
                }
            }
        }

 Any sample code or suggestions regarding how to solve this issue will be very helpful.

 

Thanks,

Pratik

Coordinator
Dec 3, 2010 at 3:23 PM
Hi Pratik,
I'll take a look tonight after work, it might be worth thinking about saving the entity with image bytes asynchronously as its quite a large amount of data, I imagine it's well over a million characters per image when stored as json. The os might be crashing due to the amount of time the main worker thread is being tied up.
Regards, Sean

Sent from my Windows Phone

From: pratikkothari1
Sent: 03 December 2010 14:55
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> I think I posted this on the other thread. I am re-posting it here. Let me know if you didn't receive the attachment of my sample code.I haven't gotten to this yet. I am stuck on a different issue involving storage of the photo from a cameraPlease try the following on an actual device and not the emulator as the emulate camera images are too small in size. Also, you will have to disconnect Zune as there are some issues. You can use the WPConnect tool as mentioned here while debugging from the device. http://blogs.msdn.com/b/katriend/archive/2010/10/26/quick-tip-using-the-wp-connect-utility-instead-of-zune-client-windows-phone-7.aspx While trying to save a record with a photo taken from the camera (photo size around 1.2 Mb), the code runs extremely slow (take around 8-10 seconds or more sometimes and app gets killed by the OS)Please see the attached sample code and if you can help me figure out the issue, that will be great. I have modified your TestMobileApplication sample to generate the same issue. Here are the modifications: Added a Photo.cs to the Entities folder and an instance is contained inside the Customer class as a property.AddCustomer.xaml – added two new buttons Camera, Gallery at the bottom that implement CameraCaptureTask and PhotoChooserTask respectively. The following event handler inside AddCustomer.xaml.cs stores the chosen photo in the Photo property of Customer and during save, this data is written to the IsolatedStorage using RapidRepository (it seems that during Serialize() method of the Serializer class, it is taking a long time – during writing and retrieval) /// <summary>
> /// Event handler for the CameraCapture or the PhotoChooser task. This event handler sets the properties
> /// for the Photo instance of this entry. /// </summary>
> /// <param name="sender"></param>
> /// <param name="e"></param>
> private void PhotoProviderTaskCompleted(object sender, PhotoResult e)
> {
> // Load the photo from the task result
> if (e != null && e.TaskResult == TaskResult.OK)
> {
> var imageBits = new byte[(int)e.ChosenPhoto.Length];
> e.ChosenPhoto.Read(imageBits, 0, imageBits.Length);
> e.ChosenPhoto.Seek(0, System.IO.SeekOrigin.Begin);
>
> var name = String.Format("MS_{0:yyyy-MM-dd_hh-mm-ss-tt}.jpg", DateTime.Now);
>
> if (customer.Photo != null)
> {
> customer.Photo.FileName = name;
> customer.Photo.FileContentAsBytes = imageBits;
> }
> }
> } Any sample code or suggestions regarding how to solve this issue will be very helpful. Thanks,Pratik
>
>
Dec 3, 2010 at 3:28 PM

Sean,

How do you save the entity asynchronously? Would it be possible for you to modify the sample I sent you to demonstrate?

Thanks,

Pratik

Dec 3, 2010 at 3:36 PM

Sean,

One other thing, as the actual picture is stored as bytes already in the Photo instance, should the Serializer.cs class try to serialize it again? It seems that it is taking the most time on the Serialize method during the FileManager’s Save().

Pratik

Coordinator
Dec 3, 2010 at 3:37 PM
Hi Pratik,
A better idea might be to save the byte array outside of the entity and just store a file name on the entity, this way you could store the bytes directly in isolated storage in a text file so there would be no serialisation step. This would be much faster.
If this sounds good, i could probably automate this scenario in the repository through an attribute or a mapping, let me know what you think.

Regards Sean.

Sent from my Windows Phone

From: pratikkothari1
Sent: 03 December 2010 14:55
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> I think I posted this on the other thread. I am re-posting it here. Let me know if you didn't receive the attachment of my sample code.I haven't gotten to this yet. I am stuck on a different issue involving storage of the photo from a cameraPlease try the following on an actual device and not the emulator as the emulate camera images are too small in size. Also, you will have to disconnect Zune as there are some issues. You can use the WPConnect tool as mentioned here while debugging from the device. http://blogs.msdn.com/b/katriend/archive/2010/10/26/quick-tip-using-the-wp-connect-utility-instead-of-zune-client-windows-phone-7.aspx While trying to save a record with a photo taken from the camera (photo size around 1.2 Mb), the code runs extremely slow (take around 8-10 seconds or more sometimes and app gets killed by the OS)Please see the attached sample code and if you can help me figure out the issue, that will be great. I have modified your TestMobileApplication sample to generate the same issue. Here are the modifications: Added a Photo.cs to the Entities folder and an instance is contained inside the Customer class as a property.AddCustomer.xaml – added two new buttons Camera, Gallery at the bottom that implement CameraCaptureTask and PhotoChooserTask respectively. The following event handler inside AddCustomer.xaml.cs stores the chosen photo in the Photo property of Customer and during save, this data is written to the IsolatedStorage using RapidRepository (it seems that during Serialize() method of the Serializer class, it is taking a long time – during writing and retrieval) /// <summary>
> /// Event handler for the CameraCapture or the PhotoChooser task. This event handler sets the properties
> /// for the Photo instance of this entry. /// </summary>
> /// <param name="sender"></param>
> /// <param name="e"></param>
> private void PhotoProviderTaskCompleted(object sender, PhotoResult e)
> {
> // Load the photo from the task result
> if (e != null && e.TaskResult == TaskResult.OK)
> {
> var imageBits = new byte[(int)e.ChosenPhoto.Length];
> e.ChosenPhoto.Read(imageBits, 0, imageBits.Length);
> e.ChosenPhoto.Seek(0, System.IO.SeekOrigin.Begin);
>
> var name = String.Format("MS_{0:yyyy-MM-dd_hh-mm-ss-tt}.jpg", DateTime.Now);
>
> if (customer.Photo != null)
> {
> customer.Photo.FileName = name;
> customer.Photo.FileContentAsBytes = imageBits;
> }
> }
> } Any sample code or suggestions regarding how to solve this issue will be very helpful. Thanks,Pratik
>
>
Dec 3, 2010 at 3:44 PM

This sounds promising. This will simplify several scenarios. One of them will be say you want to bind a list of customers to a listbox and display the ones that have a photo in green, one can bind the Entity itself to the listbox (if a View is not available) and then use the name property to figure out if a photo exists or not and change the color accordingly.

When the user goes to see the customer detail, the photo can be retrieved from IS using the name, correct?

Pratik

Coordinator
Dec 3, 2010 at 3:57 PM
Absolutely, I think this sounds like the best solution, I'll have a think about it properly tonight

Sent from my Windows Phone

From: pratikkothari1
Sent: 03 December 2010 15:44
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> This sounds promising. This will simplify several scenarios. One of them will be say you want to bind a list of customers to a listbox and display the ones that have a photo in green, one can bind the Entity itself to the listbox (if a View is not available) and then use the name property to figure out if a photo exists or not and change the color accordingly.When the user goes to see the customer detail, the photo can be retrieved from IS using the name, correct?Pratik
>
>
Dec 4, 2010 at 7:09 PM

Sean,

Did you get a chance to think about this yesterday? If this can be automated using an attribute you indicated, I won’t have to create these outside of the steps that the repository is already doing.

Pratik

Coordinator
Dec 4, 2010 at 8:26 PM
Hi Pratik, didn't get chance last night, will definitely be taking a look tonight though.
Cheers
Sean

Sent from my Windows Phone

From: pratikkothari1
Sent: 04 December 2010 19:09
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> Sean,Did you get a chance to think about this yesterday? If this can be automated using an attribute you indicated, I won’t have to create these outside of the steps that the repository is already doing.Pratik
>
>
Dec 4, 2010 at 8:30 PM

Sean,

For the time being, I have modified my code to remove the actual byte content from the Photo and storing/retrieving it directly from IS and the application is not getting killed anymore.

I went with the same approach that you mentioned yesterday in your response. It will be very beneficial to have some attribute in RapidRepository that indicates which property should not get serialized at all (if someone doesn’t want to store something for an entity) and in addition, another attribute that you can set to save a specific property as bytes in the same location where the entity was saved.

Pratik

Coordinator
Dec 4, 2010 at 9:15 PM
Hi Pratik,
If you want to have a property ignored you can use the [System.Runtime.Serialization.IgnoreDataMember] attribute.
I have got a couple of ideas about how to automate the save property as a separate byte file but I think it will take some time to implement so for the time being I might add a couple of helper methods to the file manager for getting and retrieving byte files.
What I’m thinking of is having a save file which accepts a byte array and returns a Guid which can be saved as a reference to the file.
Then a load file method which accepts a Guid.
Does this sound ok initially, I want to get the view querying into a release as soon as possible, then I can concentrate on this properly for the next release along with transactional support.
Sean.
Sent: Saturday, December 04, 2010 8:30 PM
Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Sean,

For the time being, I have modified my code to remove the actual byte content from the Photo and storing/retrieving it directly from IS and the application is not getting killed anymore.

I went with the same approach that you mentioned yesterday in your response. It will be very beneficial to have some attribute in RapidRepository that indicates which property should not get serialized at all (if someone doesn’t want to store something for an entity) and in addition, another attribute that you can set to save a specific property as bytes in the same location where the entity was saved.

Pratik

Read the full discussion online.

To add a post to this discussion, reply to this email (mailto:RapidRepository@discussions.codeplex.com@discussions.codeplex.com?subject=[RapidRepository:236790])

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 4, 2010 at 9:19 PM

Thanks for the IgnoreDataMember tip. Didn’t know about that.

Sean, the other idea sounds good. One suggestion – there should be a way to know whether the photo in our example changed or not. What I mean is, if a customer is retrieved along which the Photo instance with the filename will be retrieved. Now when the customer is modified and saved back, there should be a way to find out if the original photo filename was modified or not because you don’t want to unnecessarily write back the entire byte[] if nothing changed on the Photo.

I don’t think I am doing a good job in explaining this property but tracking whether these byte[] are dirty or not will be crucial for performance.

Pratik

From: SeanMcAlinden [mailto:notifications@codeplex.com]
Sent: Saturday, December 04, 2010 4:16 PM
To: Pratik D. Kothari
Subject: Re: Querying with Views [RapidRepository:236790]

From: SeanMcAlinden

Hi Pratik,

If you want to have a property ignored you can use the [System.Runtime.Serialization.IgnoreDataMember] attribute.

I have got a couple of ideas about how to automate the save property as a separate byte file but I think it will take some time to implement so for the time being I might add a couple of helper methods to the file manager for getting and retrieving byte files.

What I’m thinking of is having a save file which accepts a byte array and returns a Guid which can be saved as a reference to the file.

Then a load file method which accepts a Guid.

Does this sound ok initially, I want to get the view querying into a release as soon as possible, then I can concentrate on this properly for the next release along with transactional support.

Sean.

Sent: Saturday, December 04, 2010 8:30 PM

Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Sean,

For the time being, I have modified my code to remove the actual byte content from the Photo and storing/retrieving it directly from IS and the application is not getting killed anymore.

I went with the same approach that you mentioned yesterday in your response. It will be very beneficial to have some attribute in RapidRepository that indicates which property should not get serialized at all (if someone doesn’t want to store something for an entity) and in addition, another attribute that you can set to save a specific property as bytes in the same location where the entity was saved.

Pratik

Read the full discussion online.

To add a post to this discussion, reply to this email (mailto:RapidRepository@discussions.codeplex.com@discussions.codeplex.com?subject=[RapidRepository:236790])

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (RapidRepository@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Dec 4, 2010 at 9:50 PM
this definitely sounds like an interesting challenge, as soon as I’ve got the view query stuff done I’m going to start working all this out.
I guess at the moment you can have an IsDirty property on you entity that you can check before resaving the byte file, I’ll some how have to hook into a similar style check... should be interesting.
Sent: Saturday, December 04, 2010 9:20 PM
Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Thanks for the IgnoreDataMember tip. Didn’t know about that.

Sean, the other idea sounds good. One suggestion – there should be a way to know whether the photo in our example changed or not. What I mean is, if a customer is retrieved along which the Photo instance with the filename will be retrieved. Now when the customer is modified and saved back, there should be a way to find out if the original photo filename was modified or not because you don’t want to unnecessarily write back the entire byte[] if nothing changed on the Photo.

I don’t think I am doing a good job in explaining this property but tracking whether these byte[] are dirty or not will be crucial for performance.

Pratik

From: SeanMcAlinden [mailto:notifications@codeplex.com]
Sent: Saturday, December 04, 2010 4:16 PM
To: Pratik D. Kothari
Subject: Re: Querying with Views [RapidRepository:236790]

From: SeanMcAlinden

Hi Pratik,

If you want to have a property ignored you can use the [System.Runtime.Serialization.IgnoreDataMember] attribute.

I have got a couple of ideas about how to automate the save property as a separate byte file but I think it will take some time to implement so for the time being I might add a couple of helper methods to the file manager for getting and retrieving byte files.

What I’m thinking of is having a save file which accepts a byte array and returns a Guid which can be saved as a reference to the file.

Then a load file method which accepts a Guid.

Does this sound ok initially, I want to get the view querying into a release as soon as possible, then I can concentrate on this properly for the next release along with transactional support.

Sean.

Sent: Saturday, December 04, 2010 8:30 PM

Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Sean,

For the time being, I have modified my code to remove the actual byte content from the Photo and storing/retrieving it directly from IS and the application is not getting killed anymore.

I went with the same approach that you mentioned yesterday in your response. It will be very beneficial to have some attribute in RapidRepository that indicates which property should not get serialized at all (if someone doesn’t want to store something for an entity) and in addition, another attribute that you can set to save a specific property as bytes in the same location where the entity was saved.

Pratik

Read the full discussion online.

To add a post to this discussion, reply to this email (mailto:RapidRepository@discussions.codeplex.com@discussions.codeplex.com?subject=[RapidRepository:236790])

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (mailto:RapidRepository@discussions.codeplex.com@discussions.codeplex.com?subject=[RapidRepository:236790])

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (mailto:RapidRepository@discussions.codeplex.com@discussions.codeplex.com?subject=[RapidRepository:236790])

To start a new discussion for this project, email RapidRepository@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 4, 2010 at 10:24 PM
Coordinator
Dec 6, 2010 at 11:48 PM

Hi Pratik,

 

Just to let you know, I've added some helper methods for saving files outside of entities.

RapidRepository.File.Save(string fileData)

RapidRepository.File.Load(Guid fileId)

RapidRepository.File.Delete(Guid fileId)

 

The idea would be the Save method returns a Guid which can be stored on an entity as a pointer to the file.

Load returns the string fileData (which in your case you would convert back into a byte[] image)

Delete simply deletes the file.

The current trunk is getting quite close to the next beta (for V2.0) so would be grateful if you could let me know how you get on (especially with the View stuff, I think it should really help performance.

Hope this helps.

Sean.

Dec 7, 2010 at 3:03 PM

Sean,

Thanks for the notification. I am working hard this week to get my application in the marketplace. I plan to re-visit my code next week to make use of your helper functions and maybe incorporate the View concept. I will get back to you next week (with probably more questions J)

Have a great day!

Pratik

Coordinator
Dec 7, 2010 at 5:41 PM
Great news, I hope your app does well.
Also ask as many questions as you like, it's really helping to guide the API.

Let me know the name of your app once it's up in the market place.

Speak soon.
Sean.

Sent from my Windows Phone

From: pratikkothari1
Sent: 07 December 2010 15:03
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> Sean,Thanks for the notification. I am working hard this week to get my application in the marketplace. I plan to re-visit my code next week to make use of your helper functions and maybe incorporate the View concept. I will get back to you next week (with probably more questions J)Have a great day!Pratik
>
>
Dec 10, 2010 at 3:03 PM

Sean,

I wanted to share this with you. My app is on the marketplace now.

The app is called Mood Swing and its under the Social category. You can download it through Zune from here Mood Swing or you can visit this website – http://www.moodswinglife.com

The app has a Trial version so you can have fun with it. If you like the work I have done so far, it would be great if you can provide a review for the application in the marketplace.

Quick Description:

Mood Swing enables you to track your feelings and share them with the world in the most unique and elegant way.

Just pick your mood (Happy, Sad, Lonely...) and express it to your friends on facebook and twitter with our beautiful and expressive images.

Have a great day!

Pratik

Coordinator
Dec 10, 2010 at 4:57 PM
Excellent stuff, I'll take a look over the weekend.
Have a great weekend.
Sean

Sent from my Windows Phone

From: pratikkothari1
Sent: 10 December 2010 15:03
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> Sean,I wanted to share this with you. My app is on the marketplace now.The app is called Mood Swing and its under the Social category. You can download it through Zune from hereMood Swing or you can visit this website – http://www.moodswinglife.comThe app has a Trial version so you can have fun with it. If you like the work I have done so far, it would be great if you can provide a review for the application in the marketplace.Quick Description:Mood Swing enables you to track your feelings and share them with the world in the most unique and elegant way.Just pick your mood (Happy, Sad, Lonely...) and express it to your friends on facebook and twitter with our beautiful and expressive images.Have a great day!Pratik
>
>
Dec 10, 2010 at 7:57 PM

Thanks. You have a good weekend as well.

From: SeanMcAlinden [email removed]
Sent: Friday, December 10, 2010 11:57 AM
To: Pratik D. Kothari
Subject: Re: Querying with Views [RapidRepository:236790]

From: SeanMcAlinden

Excellent stuff, I'll take a look over the weekend.
Have a great weekend.
Sean

Sent from my Windows Phone


From: pratikkothari1
Sent: 10 December 2010 15:03
To: sean.f.mcalinden@live.co.uk
Subject: Re: Querying with Views [RapidRepository:236790]



> From: pratikkothari1
>
> Sean,I wanted to share this with you. My app is on the marketplace now.The app is called Mood Swing and its under the Social category. You can download it through Zune from hereMood Swing or you can visit this website – http://www.moodswinglife.comThe app has a Trial version so you can have fun with it. If you like the work I have done so far, it would be great if you can provide a review for the application in the marketplace.Quick Description:Mood Swing enables you to track your feelings and share them with the world in the most unique and elegant way.Just pick your mood (Happy, Sad, Lonely...) and express it to your friends on facebook and twitter with our beautiful and expressive images.Have a great day!Pratik
>
>

Dec 12, 2010 at 4:25 PM

Sean,

I just thought of a new idea for a WP7 app. I plan to use RapidRepository again for this one.

As far as a blog, I don’t have one yet, but I plan to start blogging soon. I will definitely mention Rapid Repository once I have the blog.

Just a thought, have you thought about creating a YouTube video of RapidRepository in action.

It is a pretty simple library to use and more people should know about it.

Pratik

From: SeanMcAlinden [email removed]
Sent: Friday, December 10, 2010 11:57 AM
To: Pratik D. Kothari
Subject: Re: Querying with Views [RapidRepository:236790]

From: SeanMcAlinden

Excellent stuff, I'll take a look over the weekend.
Have a great weekend.
Sean

Sent from my Windows Phone


Coordinator
Dec 12, 2010 at 7:44 PM
Cheers, I hope to get as many people as possible using it, makes it even more worth while building on it (I love building these types of API’s).
Haven’t thought about doing videos but that sounds like a really good idea, as soon as I’ve got Release V.2.0 out I’ll do some, I’m hoping V2.0 should be out very shortly.
By the way, really like your app, looks to be very well made, easy to use and really good graphics, I’ve added a review.
cheers,
From: [email removed]
Sent: Sunday, December 12, 2010 4:25 PM
To: [email removed]
Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Sean,

I just thought of a new idea for a WP7 app. I plan to use RapidRepository again for this one.

As far as a blog, I don’t have one yet, but I plan to start blogging soon. I will definitely mention Rapid Repository once I have the blog.

Just a thought, have you thought about creating a YouTube video of RapidRepository in action.

It is a pretty simple library to use and more people should know about it.

Pratik

From: SeanMcAlinden [email removed]
Sent: Friday, December 10, 2010 11:57 AM
To: Pratik D. Kothari
Subject: Re: Querying with Views [RapidRepository:236790]

From: SeanMcAlinden

Excellent stuff, I'll take a look over the weekend.
Have a great weekend.
Sean

Sent from my Windows Phone


Dec 13, 2010 at 2:45 PM

Sean,

Thanks for the encouraging words. Could you please do me a favor? Actually, I don’t see your review for Mood Swing in the marketplace. If you don’t see it as well, can you please re-submit the review.

I like your enthusiasm regarding RapidRepository. I have a small suggestion regarding SaveChanges() in RapidContext.cs. Please see the highlighted lines below. I had a scenario where I wanted to specifically pass in a constant GUID that I have defined in my settings file for storing the search criteria for mood filters. This record will be shared between two pages so I wanted to know the GUID beforehand. I noticed that SaveChanges() was always creating a new GUID, so I just added one line to check if a null GUID has been passed in, then during the Add, use that GUID instead of creating a new GUID.

public void SaveChanges()
{
foreach (OperationRequest request in this.operationRequests)
{
switch (request.OperationRequestType)
{
case OperationRequestType.Add:
// Pratik
if ((((IRapidEntity)request.Entity).Id == Guid.Empty) || (((IRapidEntity)request.Entity).Id == null))
((IRapidEntity)request.Entity).Id = Guid.NewGuid();

var addString = this.serialiser.Serialise(request.EntityType, request.Entity);
this.fileManager.Save(request.EntityType, ((IRapidEntity)request.Entity).Id, addString);
AddToCache(request.EntityType, (IRapidEntity)request.Entity);
break;
case OperationRequestType.Update:
var updateString = this.serialiser.Serialise(request.EntityType, request.Entity);
this.fileManager.Save(request.EntityType, request.EntityId, updateString);
EntityCache.Update(request.EntityType, request.EntityId, request.Entity);
break;
case OperationRequestType.Delete:
this.fileManager.Delete(request.EntityType, request.EntityId);
EntityCache.Remove(request.EntityType, request.EntityId);
break;
}
}

DeleteAllOperationRequests();
}

Coordinator
Dec 13, 2010 at 8:08 PM
Hi Pratik,
My review is on the marketplace now, I think it just takes a while to show up.
I’ll probably put your change into the next release V2.0, just need to write some tests.
I’m having a problem testing on my real device at the moment so I can’t release until I get it resolved as I need to do thorough testing before this release.
Thanks
Sean.
From: [email removed]
Sent: Monday, December 13, 2010 2:45 PM
To: [email removed]
Subject: Re: Querying with Views [RapidRepository:236790]

From: pratikkothari1

Sean,

Thanks for the encouraging words. Could you please do me a favor? Actually, I don’t see your review for Mood Swing in the marketplace. If you don’t see it as well, can you please re-submit the review.

I like your enthusiasm regarding RapidRepository. I have a small suggestion regarding SaveChanges() in RapidContext.cs. Please see the highlighted lines below. I had a scenario where I wanted to specifically pass in a constant GUID that I have defined in my settings file for storing the search criteria for mood filters. This record will be shared between two pages so I wanted to know the GUID beforehand. I noticed that SaveChanges() was always creating a new GUID, so I just added one line to check if a null GUID has been passed in, then during the Add, use that GUID instead of creating a new GUID.

public void SaveChanges()
{
foreach (OperationRequest request in this.operationRequests)
{
switch (request.OperationRequestType)
{
case OperationRequestType.Add:
// Pratik
if ((((IRapidEntity)request.Entity).Id == Guid.Empty) || (((IRapidEntity)request.Entity).Id == null))
((IRapidEntity)request.Entity).Id = Guid.NewGuid();

var addString = this.serialiser.Serialise(request.EntityType, request.Entity);
this.fileManager.Save(request.EntityType, ((IRapidEntity)request.Entity).Id, addString);
AddToCache(request.EntityType, (IRapidEntity)request.Entity);
break;
case OperationRequestType.Update:
var updateString = this.serialiser.Serialise(request.EntityType, request.Entity);
this.fileManager.Save(request.EntityType, request.EntityId, updateString);
EntityCache.Update(request.EntityType, request.EntityId, request.Entity);
break;
case OperationRequestType.Delete:
this.fileManager.Delete(request.EntityType, request.EntityId);
EntityCache.Remove(request.EntityType, request.EntityId);
break;
}
}

DeleteAllOperationRequests();
}

Dec 30, 2010 at 3:58 PM

Sean,

I used RapidRepository with good success on another WP7 app now. I also used the Views feature and it looks pretty good.

The app is called Resolutions and its under LifeStyle category

You can check it out from here - http://social.zune.net/redirect?type=phoneApp&id=344403e7-ec12-e011-9264-00237de2db9e

Quick Description

Use this app to quickly add your list of resolutions in your phone. Prioritize and monitor each resolution status along with sharing your progress journal on facebook and twitter to get helpful feedback from your friends. Keep your list of resolutions handy with this app and enjoy in the glory as you meet your goals.

Wish you a very happy new year!

Hopefully, you make some new year resolutions using the app J

Thanks again for providing this nice library!

Pratik

Coordinator
Jan 1, 2011 at 9:52 PM

Hiya,

Excellent stuff, I'll check it out.

Have a great new year.

Kind Regards,

Sean.