Update to EF6

This commit is contained in:
2014-07-14 17:38:14 -04:00
parent 7e3eedd844
commit 2f90035494
39 changed files with 2022 additions and 1944 deletions

View File

@@ -4,15 +4,11 @@ namespace FeedCenter
{
public partial class Category
{
#region Constructor
public Category()
public static Category Create()
{
ID = Guid.NewGuid();
return new Category { ID = Guid.NewGuid() };
}
#endregion
public bool IsDefault
{
get { return Name == "< default >"; }

View File

@@ -3,15 +3,23 @@ using Common.Xml;
using FeedCenter.FeedParsers;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Data;
namespace FeedCenter
{
#region Enumerations
public enum MultipleOpenAction
{
IndividualPages,
SinglePage
}
public enum FeedType
{
Unknown,
@@ -20,7 +28,7 @@ namespace FeedCenter
Atom
}
public enum FeedItemComparison
public enum FeedItemComparison : byte
{
Default,
Title
@@ -44,16 +52,26 @@ namespace FeedCenter
#endregion
public partial class Feed
[ValueConversion(typeof(int), typeof(MultipleOpenAction))]
public class MultipleOpenActionConverter : IValueConverter
{
#region Constructor
public Feed()
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
ID = Guid.NewGuid();
return (MultipleOpenAction) value;
}
#endregion
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int) value;
}
}
public partial class Feed
{
public static Feed Create()
{
return new Feed { ID = Guid.NewGuid() };
}
#region Event delegates
@@ -81,7 +99,7 @@ namespace FeedCenter
default:
// Save as last result
LastReadResult = (int) result;
LastReadResult = result;
break;
}
@@ -268,7 +286,7 @@ namespace FeedCenter
foreach (var itemToRemove in removedItems)
{
// Delete the item from the database
database.FeedItems.DeleteObject(itemToRemove);
database.FeedItems.Remove(itemToRemove);
// Remove the item from the list
Items.Remove(itemToRemove);
@@ -315,7 +333,7 @@ namespace FeedCenter
get
{
// Cast the last read result to the proper enum
var lastReadResult = (FeedReadResult) LastReadResult;
var lastReadResult = LastReadResult;
// Build the name of the resource using the enum name and the value
var resourceName = string.Format("{0}_{1}", typeof(FeedReadResult).Name, lastReadResult);

View File

@@ -6,15 +6,11 @@ namespace FeedCenter
{
public partial class FeedItem
{
#region Constructor
public FeedItem()
public static FeedItem Create()
{
ID = System.Guid.NewGuid();
return new FeedItem { ID = System.Guid.NewGuid() };
}
#endregion
#region Methods
public override string ToString()
@@ -31,7 +27,7 @@ namespace FeedCenter
break;
case Options.MultipleLineDisplay.FirstLine:
// Find the first newline
int newlineIndex = title.IndexOf("\n", StringComparison.Ordinal);
@@ -46,7 +42,7 @@ namespace FeedCenter
title = Regex.Replace(title, @"[ ]{2,}", " ");
// Condense tabs to one space
title = Regex.Replace(title, @"\t", " ");
title = Regex.Replace(title, @"\t", " ");
// If the title is blank then put in the "no title" title
if (title.Length == 0)