Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:59:08+00:00 2026-05-22T22:59:08+00:00

In the database I have a table called SERVICE. For this table I have

  • 0

In the database I have a table called SERVICE. For this table I have triggers after INSER/UPDATE/DELETE. When I try to insert a record into the database using EF I get the error “The member with identity ‘component_type_name’ does not exist in the metadata collection.\r\nParameter name: identity”. The column ‘component_type_name’ does not exist in SERVICE table but in table COMPONENT_TYPES_IN_SERVICE.
This is the insert trigger for table SERVICE. When I remove the trigger from the table I dont have any problem with inserting.

CREATE TRIGGER [dbo].[UpdateComponentTypesInServiceOnInsert]
   ON [dbo].[SERVICE] 
   AFTER INSERT
AS 
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @componentID int;
SET @componentID = 0;

DECLARE @ComponentTypeID int;
SET @ComponentTypeID = 0;

DECLARE @ComponentTypeName nvarchar(255);
SET @ComponentTypeName = null;

SELECT @componentID = component_id from inserted;

SELECT @ComponentTypeID = c.component_type_id, @ComponentTypeName = ct.description from COMPONENTS c
inner join dbo.COMPONENT_TYPES ct on c.component_type_id = ct.id
WHERE c.id = @componentID; 

Select * from COMPONENT_TYPES_IN_SERVICE cts
where cts.id = @ComponentTypeID;

IF (@@ROWCOUNT > 0)
    BEGIN
        UPDATE COMPONENT_TYPES_IN_SERVICE
        SET number_of_components = number_of_components + 1
        WHERE id = @ComponentTypeID;
    END
ELSE
    BEGIN
        INSERT INTO COMPONENT_TYPES_IN_SERVICE(id, component_type_name, number_of_components)
        VALUES (@ComponentTypeID, @ComponentTypeName, 1); 
    END
END

Does any one knows any solution???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:59:09+00:00Added an answer on May 22, 2026 at 10:59 pm

    You cannot do this:

    Select * from COMPONENT_TYPES_IN_SERVICE cts
    where cts.id = @ComponentTypeID;
    

    It returns COMPONENT_TYPES_IN_SERVICE record back to your application and EF tries to copy returned values into SERVICE because it thinks that you are passing back some database generated values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table called users This table has two columns (that are
I have a database table called Posts which stores all the information regarding an
I have a simple database table called Entries: class CreateEntries < ActiveRecord::Migration def self.up
Lets say I have a table in a sql server 2000 database called TransactionType:
I have a table in a MSSQL database that looks like this: Timestamp (datetime)
I have a database table called A and now i have create a new
In my Oracle database, I have a table called Customers. There are fields for
I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed
I have a table in my MySQL database called studentname . I made an
I am using a legacy database and I have a table called TEAM_PLAYER. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.