TextBlob properties aren't retrieved
public class OperationalPointCollection : IOperationalGeometry
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
public IMultiPoint Points { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.CascadeRead)]
public OperationalPointType PointType { get; set; }
[ForeignKey(typeof(OperationalPointType))]
public int OperationalPointTypeId { get; set; }
[ManyToOne]
public Operation Operation { get; set; }
[ForeignKey(typeof(Operation))]
public int OperationId { get; set; }
[TextBlob("PointIdsBlobbed")]
public List<string> PointIds { get; set; }
public string PointIdsBlobbed { get; set; }
}
I would expect the following to load PointIds but it does not:
connection.GetChild(this.CurrentOperation, o => o.OperationalPoints, true);
The workaround specified in http://forums.xamarin.com/discussion/4580/cross-platform-sqlite-orm doesn't work because of #50
Comments (11)
-
reporter -
I'll take a look. It should always load text-blobbed relationships regardless of the
CascadeOperation
parameter (that is always set toNone
). So I'll either fix#50by adding a setter to the attribute or by always loading and writing textblobbed properties. -
I just stumbled on the same exact problem. Is there any working workaround?
-
reporter I have to insert and then update immediately and then it works. For the store:
var connection = this._connectionProviderService.Create(); connection.RunInTransaction(() => { if (pointCollection.Id == 0) { connection.Insert(pointCollection); // This is stupid but it's to workaround TextBlob properties // not inserting with InsertWithChildren. connection.UpdateWithChildren(pointCollection); Mvx.Resolve<IOperationsService>().Points.Add(pointCollection); } else connection.UpdateWithChildren(pointCollection); });
For retrieval I made a custom attribute:
// Workaround for // https://bitbucket.org/twincoders/sqlite-net-extensions/issue/51/textblob-properties-arent-retrieved public class TextBlobCascadedAttribute : TextBlobAttribute { public TextBlobCascadedAttribute(string textProperty) : base(textProperty) {} public override CascadeOperation CascadeOperations { get { return CascadeOperation.All; } } }
-
I'm currently working on it, it should be on NuGet tomorrow morning.
-
Thanks a lot for this.
-
reporter Great. Can you also fix the
connection.InsertWithChildren
issue with text blobs? -
Yes, they are related.
-
- changed status to resolved
It should be fixed on the master branch right now
-
Fixed in NuGet version 1.2.3, can you verify that the fix works for you?
-
It seems to work fine for me now (for the read operation). Thanks for your reactivity!
- Log in to comment
connection.InsertWithChildren also fails when there's a TextBlob