Hi guys!
1. Is there a way to perform bulk insert/update without switching StoreGenerationPattern from Identity to None?
2. If answer to (1) is no, can we retrieve metadata about table/column names corresponding to entities and about constraints defined in the model to build SQL query manually with Array Binding usage? As I understand Array Binding would help there?
Bulk insert/update with autogeneration ids
Re: Bulk insert/update with autogeneration ids
We are investigating the possibility to implement this feature, but can't tell any timeframe at the moment. We will inform you when any results are available.1. Is there a way to perform bulk insert/update without switching StoreGenerationPattern from Identity to None?
Yes, you could use Array binding -> http://www.devart.com/dotconnect/oracle ... yBind.html.As I understand Array Binding would help there?
You could also try using the OracleLoader class -> http://www.devart.com/dotconnect/oracle ... oader.html.
JIC: we recommend you to use the OracleLoader class due to the fact, that it was improved since dotConnect for Oracle 7.9.322. For more information please refer to http://forums.devart.com/viewtopic.php?f=1&t=27982.
It is possible to do by creating a custom template, which will generate the code according to the existing model (if you are working with Entity Developer, create template for it via the Model Explorer-> Templates-> New Blank Template; if it is EDM Wizard/Designer, create a standard T4-template).can we retrieve metadata about table/column names corresponding to entities and about constraints defined in the model to build SQL
If your model objects contain all columns of the corresponding database table and there are no inheritances/complex types, the generated code could be like this:
Code: Select all
public static void LoadDepts(OracleConnection connection, IEnumerable<Dept> allDepts) {
// check connection and allDepts
// ...
// Load data
OracleLoader loader = new OracleLoader("YOUR_TABLE_NAME", connection);
loader.CreateColumns();
loader.Open();
foreach (var dept in allDepts) {
loader.SetValue("DEPTNO", dept.Deptno);
loader.SetValue("DNAME", dept.Dname);
loader.SetValue("LOC", dept.Loc);
loader.NextRow();
}
loader.Close();
}
Re: Bulk insert/update with autogeneration ids
The current EF6 architecture doesn't allow to use Batch Updates with StoreGeneratedPattern=Identity/Computed.Partizan wrote:1. Is there a way to perform bulk insert/update without switching StoreGenerationPattern from Identity to None?
A workaround for the case when the current context instance is used for the batch updates operation only: modify a metadata, used for creating context instance, by removing StoreGeneratedPattern=Identity/Computed from properties. This is easier to do with fluent mapping (this is possible with XML Mapping as well).