This is a migrated thread and some comments may be shown as answers.

Skip any changes (don't track changes) for some domain model types(exactly views) and don't generate sql to update such views

0 Answers 27 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gennadiy
Top achievements
Rank 1
Gennadiy asked on 08 Feb 2017, 08:08 AM

Hello,
I have such problem:
We get data from views, and then we change some properties in view record entities.
When I try to save changes, these records are marked as changed (dirty).
So, How can I tell DataAccess to skip any changes (don't track changes) for some domain model types (exactly views) and don't generate sql to update such views?
Is it possible?
I tried to add these types as views to model configuration, and set it as readonly, but it still generates sql to change these records in db.

 

var view = new MetaView(
name: type.Name,
schemaName: schemaName,
fullName: string.Format("{0}.{1}", schemaName, type.Name),
readOnly: true,
pkConstraintName: string.Empty,
insertProcedure: null,
updateProcedure: null,
deleteProcedure: null,
removeRowsProcedure: null,
description: null
);

type.Table = view;

model.Views.Add(view);

 

But I still get exception:

Update failed: Telerik.OpenAccess.RT.sql.SQLException: Cannot update the view or function 'dbo.vwg_XYZ' because it contains aggregates, or a DISTINCT or GROUP BY clause, or PIVOT or UNPIVOT operator. Statement(s) could not be prepared.

Thank you.

Tags
Development (API, general questions)
Asked by
Gennadiy
Top achievements
Rank 1
Share this question
or