Is it possible to link properties between entities in orient db? - orientdb

If I have a property name in my class Project, is it possible to link that property to the property project_name in my class User?
I know that I can link a record to another record with a link, but I would like something similar between properties.

It is not possible since properties do not have an identity (physical position) like records, they are only values inside of records.

Related

Dynamically Selecting Data from Table in Entity Framework

I know this question might have been asked before but I have not found a single answer yet.
Basically I am using entity framework and I am in need of selecting data from a database without knowing the name of the table, as this will be generic.
Now if I do not know the table name, I do not know the type too as I have tried using context.Database.SQLQuery or context.Database.ExecuteSQLStatement but these all require the type of the object it should be expecting.
All I am receiving as parameters are the name of the table and the row ID.
Could anybody give me further advice?
Thanks.
#
Edit:
I have just been notified that the only property I would need from this table is the Name field...

Entity Framework (6.x), Computed Columns and INotify

I'm using a DB First implementation of Entity Framework and I've run into an issue with a need for a computed column and the interaction with a view...
Scenario:
User has FirstName and LastName. In a listbox I want to use a display name generated from FirstName and LastName. Generally, simple enough. The issue comes from when either the first name or last name gets edited. I've extended my entities with INotifyPropertyChanged and implemented that in the T4 template. I extended the User entity to create a DisplayName property. In the View I use a CollectionViewSouorce based on the DisplayName.
The issue comes in when a user's name is edited, but no notification occurs because the change is made to either FirstName or LastName, not DisplayName. So the CollectionViewSource is never getting a change notification for DisplayName.
I could, manually, add an OnPropertyChanged("DisplayName") to the User entity in the FirstName and LastName properties, but that would be overwritten next time I update my model from the DB.
Any ideas on how to make this work?
Thanks.
J
I'd go for one of the following options:
create partial class User to your User entity with OnFirstNameChanged,OnLastNameChanged methods implemented in it, the class remains unchanged when you re-generate classes from model.
handle context.ObjectStateManager.ObjectStateManagerChanged event of your ObjectContext
http://msdn.microsoft.com/en-us/library/system.data.objects.objectstatemanager%28v=vs.100%29.aspx
adjust the t4 template(based on your question you know how to deal with it) to call custom method when FirstName and LastName property setter is generated.
For the record...
I went with a partial class extension and just programmatically triggered OnPropertyChanged for the DisplayName whenever the constituent properties were changed and saved.

How to use Entity, Mapper, Service and Hydrator in ZF2

I am making a ZF2 app. I am using entities, mappers and services (e.g. UserEntity, UserMapper, UserService) to manage the objects/models. Properties in the entities are CamalCased (e.g. FirstName, LastName) while in the database, fields are using underscore (first_name, last_name). I will plan to use a hydrator to map the properties and db-fields when retrieving or saving. The service object (UserService) will be used to communicate with the mapper to retrieve and save data models using the mapper. The hydrator will convert the result of mapper and convert them into proper entities.
The thing I am confused is that when the service (UserService) need to provide some cirteria - for example to find all users with a specific 'last name', will the service use the database field names (last_name) or entity properties name (LastName)?
If the db field name is used in the Service, so any change in the db structure will require me to update the service also, which completely fails the reason of using the whole approach.
If you take a look at the ClassMethods:hydrate method (https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/Hydrator/ClassMethods.php) you will see that it just copies the properties from one object to another. You have the option of converting the property names to/from camelCase but that's it.
If you change a column name in your database then you will need to change corresponding property name in your object. And vice versa. Which I believe is the crux of your question?
If you want to make table column names be independent of your method names then you need something that lets you define an actual mapping table somewhere. Change a column or method name and you only need to update the configuration mapping table.
Not a ZF2 expert so I could be wrong but it doesn't look like any of the supplied hydrators support this.
I do know that Doctrine 2 supports it.

How do I get the column name from an Entity Framework Association

I have an entity model built using the designer. In one of my tables (application), I have several foreign keys that reference the same status (status) table. As a result, when my associations were built, I have several entity objects built with an auto indexing name:
application_statuses2
application_statuses3
etc.
I'm building a "version history" type screen and want to be able to properly list the "friendly name" for each column modified. For example, I want to display "Destination Status" will be displayed instead of "application_statuses2". If I can determine the endpoint column name on the association in question, I can setup the proper display value.
I can find the entity object in the designer, I can even track where it references the foreign key in question that built the association, but I can seem to find the property that outlines the enpoints or column names. How do I determine the column name, or endpoint, on my association, or entity?
I wish it were more ready to hand, have been looking for it as well. Bit of a pain when you have multiple FKs to the same table.
Click on the navigation property you want to check
Under properties, look at the name of the association
At the top of properties, use the object navigator dropdown to switch to the association
Click into the 'Referential Constraint' property
Use the ellipses button on the right to bring up the column names
Dont know if there is a better way of doing this, but I certainly hope so!

Workflow Dependency Property

I have a Person class with a name property.
I have a custom activity that have this Person object as a dependency property.
Now when I drop this custom activity into the workflow designer. I can see the Person in the property grid.
From the designer I'd like to be able to specify the name of the person.
Is this possible? Or the only way is to really create a Name property in my Custom activity.
Since this is unanswered for ages now I'll add an answer because it might help someone.
From what I understand you have an object x stored in a property of control and you'd like to show a property of the object x.
An example could be a combobox which contains an array of person. But you don't want person to show in the combobox. You might want to show their names.
You can achieve that by setting DisplayMemberBinding="name".