entity framework firebird no primary index - entity-framework-5

If I create my code with model first, the mapper creates the Data as I expected. But when I save some new data to the Database the primary key for all data is 0.
The Entity Framework doesn't increment the Index.
What is wrong?
I'm using Firebird2.5 and the newest .net-Provider.

Firebird has no Autoincrement for the primary keys.
Look in the Properties of the created classes there is a property which handles the key generation. This is the StoreGeneratedPattern Property and it must set to Identity.

Related

Name the primary key of Container in Cosmbos DB Sql Api different than "id"

I am working on Azure and I have created a database with Cosmos DB SQL API. After creating a container I see that the primary key is always named "id". Is there any way to create a container with PK with name different than "id"?
Every document has a unique id called id. This cannot be altered. If you don't set a value, it is assigned a GUID.
When using methods such as ReadDocument() (or equivalent, based on the SDK) for direct reads instead of queries, a document's id property must be specified.
Now, as far as partitioning goes, you can choose any property you want to use as the partition key.
And if you have additional domain-specific identifiers (maybe a part number), you can always store those in their own properties as well. In this example though, just remember that, while you can query for documents containing a specific part number, you can only do a direct-read via id. If direct reads will be the majority of your read operations, then it's worth considering the use of id to store such a value.
PK = primary key, by the way ;) It's the "main" key for the record, it is not private :)
And no, as far as I know you cannot change the primary key name. It is always "id". Specifically it must be in lowercase, "Id" is not accepted.

Can we add primary key to collection datatypes?

When I tried to retrieve table using contains keyword it prompts "Cannot use CONTAINS relation on non collection column col1" but when I tried to create table using
CREATE TABLE test (id int,address map<text, int>,mail list<text>,phone set<int>,primary key (id,address,mail,phone));
it prompts "Invalid collection type for PRIMARY KEY component phone"
One of the basics in Cassandra is that you can't modify primary keys. Always keep that in mind.
You can't use a collection as primary key unless it is frozen, meaning you can't modify it.
This will work
CREATE TABLE test (id int,address frozen<map<text, int>>,mail frozen<list<text>>,phone frozen<set<int>>,primary key (id,address,mail,phone));;
However, I think you should take a look at this document: http://www.datastax.com/dev/blog/cql-in-2-1
You can put secondary indexes on collections after cql 2.1. You may want to use that functionality.

Default primary key setter and getter generated by Service Builder

I'm working with Liferay. When create an entity, we define one column as the primary key. Then I look at the entity model, I see some methods setPrimaryKey, getPrimaryKey as well as the setter and getter of the column that we defined as the primary key before. What is the difference of these methods? Do we need to use both methods once we add new entity into the table or just one
Assuming that your project is built by many people. Some one designs entity and you only code view page. When you want to get or set primary key of entity but you don't know what column. If don't have setPrimaryKey or getPrimaryKey methods, do you look up in the code to find what column is primary key?

Creating associations in EDM model on unique keys

I'm developing a new application which is based on a legacy database. The old legacy database does not use reference integrity and first we try to not change the existing schema. I still want to be be able to use navigation properties in my EF generated POCO classes.
However, the old data model has one big issue regarding child-parent relationships: the column in the child table is referencing the parent table via the uniqe key of the parent, not via the primary key of the parent table. Is it still possible to generate such associations?
I tried to mark the unique key in the parent table as "entity key" but then I still need to provide a mapping for the parent table's primary key which I am not able to because there is no mapping for it available, this primary is just a dummy "counter". If I do not provide a mapping for the primary key, I get
"Error 111: Properties referred by the Principal Role XXX must be exactly identical to the key of the EntityType YYY referred to by the Principal Role in the relationship constraint for Relationship ZZZ. Make sure all the key properties are specified in the Principal Role"
No EF does not support unique keys at all. It is hopefully planned feature of the next major release.

Is there any demo to insert a new record into a table with identity primary key using Subsonic 3?

Is there any demo to insert a new record into a table with identity primary key using Subsonic 3?
Create DAL object
Assign values to all properties except primary key property
Call Save()
Subsonic takes care of the identity keys itself you need not worry.
http://subsonicproject.com/docs.
I don't know if this has made it to the current version, but Rob showed an example to use a lambda expression to insert a record:
db.Insert.Into<Northwind.Region>(x => x.RegionID, x => x.RegionDescription)
.Values(6, "Hawaii").Execute();
http://blog.wekeroad.com/subsonic/subsonic-3-0-preview-1-linq-has-landed/

Resources