What is error 3004? - asp.net-mvc-3

I updated my database and the I got this message:
Error 3004: Problem in mapping fragments starting at line
927:No mapping specified for properties User.Username in Set User.
An Entity with Key (PK) will not round-trip when:
Entity is type [Db_AcsModel.User]
C:\Users\User\Desktop\MVC\ACS.Domain\AcsModel.edmx

You most likely added a new filed or deleted a filed but the property for the field still exist in your designer and entity class you can manually delete or map the entity variable or you can delete the entity and update your model again.

Related

Is there a way how to recreate a field for a Dynamics CRM entity?

Our particular situation is that we have a DateOnly field and would like to change it to DateTime field supporting also the time portion. The operation is not allowed in UI and it's also stated in the documentation. Hence, I excepted deleting the field and recreating it with the new setting would work.
However when I try to create the field with the same name the Duplicate Field Name error is thrown. I've read the column actually still exists behind in the DB.
Of course, I could create a field with a new name but it would require changing all related workflows and code customizations.
Is there a way how to overcome this issue?
Deleting and recreating an attribute with the same name but different type should work - of course with the caveat that you have to remove all dependencies before deleting the attribute and recreate them with the new attribute.
The Duplicate Field Name error seems to indicate that the field still exists - perhaps the entity needs to be published after deleting.
You may also find the XrmToolbox tool Attribute Manager helpful.
It allows you to migrate an attribute and its data to a new attribute.

"Failed to add object with ID as the object already exists" but object not visible in playground test environment

I am testing my code on composer-playground. When I try to add a participant through a transaction, I receive an error "Failed to add object with ID --- as the object already exists".
However, when I go to 'test' section, and click the participant type, nothing is listed.
I created a participant with the same ID a few hours ago but it has disappeared after I redeployed my changes. Not sure where it went as it clearly hasn't been deleted.
If you change your model by adding/removing fields that are not optional, or by renaming fields, any existing data that does not match the model 'disappears' from view. However the data is still there and re-appears if you change the model back.
It seems likely that you have changed the model but have residual 'hidden' data and you can't create a new object with the same key you have already used.
This is more fully explained in the Composer Knowledge Wiki.

Is it possible to change primary field of custom entity after it has been created in dynamics 365?

I have many custom entities for that I need to change primary field, I already know creating workflow that will update values of primary field by coping it from different field. But I don't want to do that.
Is there any way to change primary field of custom entity after it has been created?
The primary field of an Entity (as well other custom fields) cannot be changed after the creation. If you must change the primary field name, you need to delete and recreate the Entity.
You said change, what kind of change you need. Pick your answer from below.
On Create of new entity: changes in primary field (new_name)
Display name change - possible.
Data type change - impossible.
Schema name change - possible.
Requirement level change - possible.
On Update of entity: changes in primary field (new_lookupdisplaytext)
Display name change - possible.
Data type change - impossible.
Schema name change - impossible.
Requirement level change - impossible.

Odoo Warning "Perhaps a module was partially removed or renamed"

When I run odoo server, I got this warning message below.
WARNING dietfacts2 openerp.modules.loading: Model product.nutrientitem is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
I know that it shows this warning message because I created the model name but then I changed it afterward. The model was saved to postgres DB. I tried to delete the table in DB but unsuccessful.
dietfacts2=# delete from ir_model where model = 'product.nutrientitem';
ERROR: null value in column "model" violates not-null constraint
DETAIL: Failing row contains (1011, 2017-02-20 04:15:05.207869, 2017-02-20 04:15:05.207869, 285, null, f, false, product_nutrientitem_write_uid_fkey, null, null, null, null).
CONTEXT: SQL statement "UPDATE ONLY "public"."ir_model_constraint" SET "model" = NULL WHERE $1 OPERATOR(pg_catalog.=) "model""
Likely you have data in other tables that needs to be cleared first. Try ir_model_data
DELETE FROM ir_model_data WHERE model = 'your.model';
Then you should be able to delete your table. If you have constraints related to your table you may need to identify these and remove them as well.
You have stale model data in your db. Usually is due to a model that has been removed/renamed or a module not uninstalled properly.
A useful module to handle these situations:
https://github.com/OCA/server-tools/tree/11.0/database_cleanup
https://www.odoo.com/apps/modules/11.0/database_cleanup/
It allows you to purge stale data for models, actions, etc, whatever "orphan" record is still in your db. You'll find a control panel for database cleanup under technical section.

Changing one table in EDMX file affect all actions at project. The schema is not valid

We are using VS2010 and MVC 3.
This project was working fine. With over 40 tables in EDMX Model. We change a one table over EDMX file and then nothing work.
All actions (related or not with change) gives this error:
The scheme is not valid. Errors:
The type has no key member. Both RelationshipType as EntityType must
have members with BaseType key or key members. The type has no key
member. Both RelationshipType as EntityType must have members with
BaseType key or key members.
Description: An unhandled exception when running the current Web
request. Check the stack trace for more information about the error
and where it originated in the code.
All tables has a key...
We are restoring a old backup, and working fine... rebuild and then nothing work. !!!
Any idea, thank you in advance...
For example: (this is a piece of Modelo.designer.cs)
public ObjectSet Clientes {
get
{
if ((_Clientes == null))
{
_Clientes = base.CreateObjectSet("Clientes"); // ERROR HERE
}
return _Clientes;
}
}
Same error for all tables in the Model (EDMX). We are rebuild Model.designer.cs using right mouse menu option "execute custom tool"
We deleted old Model, create a new and... the same error.
Change EDMX model and then do update model from database -> refresh -> table

Resources