Transformable Attributes in Core Data using swift 3 - core-data

I have a Core Data model with a multiple transformable attribute. I also have this attribute use a custom NSValueTransformer, setup in the model properly. I can not found any example of transformable attribute using core date for swift 3.
How to create transformable object in NSManagedObject class?
How to create a string transformable and save in core data and fetch
the details from core data?
Is there any blog example of this? If You have any idea about this please help.
Thanks in advance.

Related

EDMX Updates clears model class data annotation

I have EDM model classes generated by entity FrameWork DB first approach. Everytime I update EDMX all the classes that have I added validation,schema, attribute names to be displayed are gone.
What is the best approach to handle this situation ?
enter image description here
enter image description here
The generated classes are partial, so you can generate your own properties and methods into a new partial class (in different file) for associate generated class.
Hope my answer could help.

Unmarshall to an existing model

Based on this example Keep child-parent relationship after unmarshalling I'd like to know if it's possible to unmarshall xml file into an existing model (not having the JAXB annotations). My idea is to directly unmarshall into Primefaces Menu Model (https://www.primefaces.org/docs/api/6.0/org/primefaces/model/menu/package-summary.html). Is it possible?
JAXB is configuration by exception, so if your model matches the xml, annotations are not necessary.
Here a blog post and a stackoverflow answer by Blaise Doughan on the topic.
It is possible (if your model is straightforward enough to be JAXB-compatible or with MOXy external mappings), but I would really not recommend it.
If you map to existing model, your XML representation becomes dependent on this existing model. And should the existing model change (like, you update the version of the library you use), you won't be able to unmarshal existing XML and will need migration mechanisms.
From my point of view, it is better to write an XML Schema and compile it to schema-derived classes. Then have a conversion routine to transfrom unmarshalled object structure to the target existing model.

Generate xml from Poco entity generated model

How can I generate a Poco model from Entity framework, which can be used to persist an object instance to xml? Basically I would like to know what the T4 template looks like for this?
You can use ADO.NET POCO Entity Generator

Store image in core data

I want to store image for every employee while updating their records. How can I do that?
I have a dictionary storing name, id and department of employees. Now i want the image to be saved together.
Core Data supports the "Binary Data" type - When you define a model with a Binary Data field, it creates your model class with an NSData field. You can move an image into the NSData field, and CoreData will save it for you.
You can then use UIImage initWithData: to load the image from the NSData field.
Hope this helps !
For strore image as CoreDate attribute need:
Add transformable attribute and set transformer with own class
Implement ImageToDataTransformer
See here for an example http://www.iphonedevsdk.com/forum/181656-post3.html

Is there deep loading in subsonic?

I am new in subsonic, and can't find the way to load data whith it's parents or childs data in one query. Is it possible in subsonic?
Basically no SubSonic 2 does not support deep loading. It is possible in SubSonic 3 using IQueryable however. See the following post for more:
Subsonic Deeploads: Is This Supported?
You CAN do it with subsonic 2. Make a partial class with the same namespace and class name.
Then create a property that loads the data when it is called.

Resources