SwiftUI/CoreData: how to persist an array of an entity within another entitiy - core-data

Using CoreData, ive been trying create a folder item type that can contain folders. I figured creating an array of objects would work but the entity i created cant be used as a data type. is there a way around this?

Related

Saving a form part way through mongodb

I'm pretty new to MongoDB and best practices. I'm using Node full stack JS.
I created a form which spans multiple screens. This saves to a mongoose.model Schema and creates a document when the user submits the form.
I've been given the requirement to allow the user to save the form when part way through. The problem with trying to save to the existing Schema is I get a duplicate id reference error as I'm saving multiple fields as null which already exist in the Collection. Plus I'm thinking this is a waste of memory.
The answer is very simple it just took me some circular thinking to get to it. I check to see if properties are undefined before setting them. If they are undefined they are an empty value rather than null i.e. {} for an Object. Mongoose is ok with that, it just doesn't like null values (makes sense).

Pulling custom field into Rally Query

I am creating a Query using the Rally/Excel plug-in. I am creating the report with a base type of Task but want to include User Story information in the Query.
I have been able to do this before by adding "WorkProduct.Release" into the columns listing. That works no problem. When I attempt this with a custom field named "CR#" I get no contents being returned.
I am able to pull custom fields from the Task itself without issue it just appears to be an issue when pulling from the parent object.
I have verified the field name and that the content is actually populated. Does anyone know a way to pull this data via the excel plug-in or if there is a limitation with pulling custom field information from a parent?
In Web Serivces API Workproduct attribute is Artifact. Artifact is a parent of Task, HierarchicalRequirement (user story) and Defects, and other work item types. Those types can have custom fields created on them, but the parent Artifact is not aware of them. It is not possible to traverse from Artifact to a custom field, and it should also not be possible to traverse to Iteration or Release from Artifact. Those fields do not exist on Artifact object in the API. It is possible to traverse Workproduct.FormattedID because FormattedID attribute exists on Artifact. That's where work item types inherit the FormattedID from. If I use Workproduct.Release or Workproduct.Iteration in Excel plugin in a query on a Task object following this syntax:
(Workproduct.Iteration = /iteration/12352898163)
I get this error:
(Workproduct.Iteration.Name = it123)
will produce a similar error.
I put this to the Rally Support folks and got the following answer, so the short answer is no...can't be done:
When you query using WorkProduct.FormattedID on a task, the data can
be returned because that field is part of "Artifact". You can see
this by looking at the Web Services API information, which I have
included some screenshots to illustrate this. The custom field you
are trying to query doesn't reside on Artifact, so is not found by the
query.
The actual work product that has your custom field would be either a
defect or a story, but the Task object does not reference back to that
to allow you to query.
You could do another query for the different work products and include
the custom field, then combine the two worksheets.

Sharepoint Extenal List and Custom Field Types

I have an odd issue.
I have client that wants a sharepoint list what is populated from a WCFService. That part is working quite well.
I have a bdcmodel that is mapping the WCF data and I can create an external list from the bdcmodel as well so that is working fine.
The issue I have is that one of the properties in the model is actually a collection of entities called Attributes. The objects in this collection simply have 2 properties Name and Value so really they are just a key value pair.
The client wants to see the list of attributes of the parent entity in the external list. So there would be an Attributes column and within that column would be the list of attributes for each parent object.
Is there even a way to do this? I am looking into Custom Field Types, but it seems like these are really intended to be singular values.
How would I create a list within and external list?
Any help anyone can give would be great even if its just to tell me that there really isn't a stable way to do this so I can go back to the client and tell them we will need to build a custom list to support this because the OOB external list and custom fields and custom field types won't support this kind of nested listing.
I decided to set up the custom field as a string and when I get my collection in from the BdcModel I am serializing it to JSON and then passing it to the field. When the field is viewed in display, edit or new I have overridden the FieldRenderingControl and I am tiling the collection out that way.

Xcode 4.3 Core Data how to make a list?

I am new to iOS development (and objective-C & Xcode 4.3) and I want to create an app with profiles for users. I understand how to use Core Data to make a table with entities and that's all fine, but I don't know how I would go about creating a model so that a user can save a list of items (ie a MutableArray).
For example I need to have a username (for the profile) and than a list of strings that are saved to his account.
Would I need to just create an table with username and string item and than just query for all tuples that contain the username. Is there a simple way to serialize an object and save it the same way it's done in java.
Thank You.
You need to create a one-to-many relationship (which makes a NSSet of "destination" objects, or if you want to keep them in the specified order, click Ordered and it will be a NSOrderedSet).
Once you have the relationship, you can add multiple items to it and access it via the set.

Accessing Aggregate Entities without Lazy Loading

I want to follow the DDD philosophy and not access entity objects of an aggregate directly. So, i have to call the root object to get the associated entity. But In other cases I dont always want every associated entity to load when the root is called. Is that the purpose of lazy loading?
How do I access entity objects through the root without loading all the associated objects everytime if i disable lazyloading feature of linq?
EDIT:
For example, If I have a Person as the Root Entity, and the Person has Name, Addresses and OwnedProperties. If I want to get a list of People so that I could display their names, I dont necvessarily want to load up Owned Properties every time on the call to the Repository. Conversely, on another page I may want to show a list of OwnedProperties, but do not want the other information to load with the call. what is the simple way of just calling the Person without the owned property entity other than creating a new person object without that owned properties?
I don't thinks that's possible without lazy loading.
Getting all data at once: Eager Loading
Getting data when accessed: Lazy Loading
According to your edit:
What I do in these situations, is create a 'View' class or a 'DTO' class which just contains the properties that I'm interested in.
For instance, I could have a 'PersonView' class which just has a Name property for instance.
Then, using my OR/M mapper (I use NHibernate), I create a HQL query (or Criteria query) which works on my 'Person' entity. Before I execute the query, I tell NHibernate that I want 'PersonView' objects as a result (I specify a projection). Then, NHibernate is smart enough to execute a query that only retrieves the columns that are necessary to populate the PersonView instances.
One way to avoid lazy loading is just using the object 'id'

Resources