Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/coredata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ public enum NSPersistentStoreUbiquitousTransitionType : nuint_compat_int {
InitialImportCompleted
}

[Native]
public enum NSSnapshotEventType : nuint_compat_int {
UndoInsertion = 1 << 1,
UndoDeletion = 1 << 2,
UndoUpdate = 1 << 3,
Rollback = 1 << 4,
Refresh = 1 << 5,
MergePolicy = 1 << 6
}

[BaseType (typeof (NSPersistentStore))]
// Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: NSMappedObjectStore must be initialized with initWithPersistentStoreCoordinator:configurationName:URL:options
[DisableDefaultCtor]
Expand Down Expand Up @@ -127,6 +137,9 @@ public interface NSEntityDescription : NSCoding, NSCopying {
[Export ("managedObjectClassName")]
string ManagedObjectClassName { get; set; }

[Export ("renamingIdentifier")]
string RenamingIdentifier { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool as long as they don't do string pointer comparisons (it'd have to be NSString if so).

@mandel-macaque mandel-macaque May 4, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, in the tests I have the following and passes:

 [Test]
 public void GetSetRenamingIdentifier ()
 {
     using (var pd = new NSPropertyDescription ()) {
         Assert.IsNull (pd.RenamingIdentifier);
         pd.RenamingIdentifier = "Foo";
         Assert.AreEqual ("Foo", pd.RenamingIdentifier);
     }
 }

So AFAIK we can use a managed string.

@mandel-macaque mandel-macaque May 4, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pasting the gutter conversation:

Chris Hamons @chamons 18:15
well so that works, but that isn't exactly what i mean
in some corners of Cocoa, you have to pass in a "known" identifier
and so you go myThing = SomeGlobalThing
and as opposed to actually doing a string compare, they just compare the pointer of that global to you identifier
so if you round trip NSString -> C# string -> NSString it doesn't work
but identifier seems ok, i don't see any constants you need to shove in
(don't know this API)

Manuel de la Pena @mandel-macaque 18:17
@chamons the API does not work like that, you are passing the renaming of a property, so you have model X, witha property Y, then you update the object to rename Y to Z and that RenamingProperty allows to do the match

Chris Hamons @chamons 18:17
then you are safe and get my

Manuel de la Pena @mandel-macaque 18:17
@chamons is like, hey this is a property that used to be called Manuel, but now is Pedro


[NullAllowed] // by default this property is null
[Export ("name")]
string Name { get; set; }
Expand Down Expand Up @@ -252,6 +265,16 @@ public interface NSEntityMigrationPolicy {
bool EndEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, out NSError error);
}

[BaseType (typeof (NSPropertyDescription))]
public interface NSExpressionDescription {

[Export ("expression")]
NSExpression Expression { get; set; }

[Export ("expressionResultType")]
NSAttributeType ResultType { get; set; }
}

[BaseType (typeof (NSPropertyDescription))]
public interface NSFetchedPropertyDescription {

Expand All @@ -260,6 +283,28 @@ public interface NSFetchedPropertyDescription {
NSFetchRequest FetchRequest { get; set; }
}

[DisableDefaultCtor]
[BaseType (typeof (NSExpression))]
public interface NSFetchRequestExpression {

[Internal]
[DesignatedInitializer]
[Export ("initWithExpressionType:")]
IntPtr Constructor (NSExpressionType type);

[Static, Export ("expressionForFetch:context:countOnly:")]
NSFetchRequestExpression FromFetch (NSExpression fetch, NSExpression context, bool countOnly);

[Export ("requestExpression")]
NSExpression Request { get; }

[Export ("contextExpression")]
NSExpression Context { get; }

[Export ("countOnlyRequest")]
bool IsCountOnly { [Bind ("isCountOnlyRequest")] get;}
}

[BaseType (typeof (NSPersistentStoreRequest))]
public interface NSFetchRequest : NSCoding {

Expand Down Expand Up @@ -548,6 +593,9 @@ public interface NSManagedObject {
[Export ("isFault")]
bool IsFault { get; }

[Export ("faultingState")]
nuint FaultingState { get; }

[Export ("hasFaultForRelationshipNamed:")]
bool HasFaultForRelationshipNamed (string key);

Expand Down Expand Up @@ -926,6 +974,9 @@ public interface NSMappingModel {
[Static, Export ("mappingModelFromBundles:forSourceModel:destinationModel:")]
NSMappingModel MappingModelFromBundles (NSBundle[] bundles, NSManagedObjectModel sourceModel, NSManagedObjectModel destinationModel);

[Static, Export ("inferredMappingModelForSourceModel:destinationModel:error:")]
NSMappingModel GetInferredMappingModel (NSManagedObjectModel source, NSManagedObjectModel destination, out NSError error);

[Export ("initWithContentsOfURL:")]
IntPtr Constructor (NSUrl url);

Expand Down Expand Up @@ -1451,6 +1502,9 @@ public interface NSPropertyDescription : NSCoding, NSCopying {
[Export ("versionHashModifier")]
string VersionHashModifier { get; set; }

[Export ("renamingIdentifier")]
string RenamingIdentifier { get; set; }

// 5.0
[Since (5,0)]
[Export ("indexedBySpotlight")]
Expand Down