Comments (4)
Two issues what I have at this moment:
- I didn't find a way to use create a command to work with several rows for CRUD.
For example, I expect to select records with ID =1,2,3. How can I do it?
Now, I have to do it in the loop.
foreach (CRUDInfo retriveInfo in rInfoList)
{
q.Condition = ((QField)retriveInfo.IdPair.Key == new QConst(retriveInfo.IdPair.Value));
selectComand = dbContext.CommandBuilder.GetSelectCommand(q);
dbContext.InitCommand(selectComand);
using (var rdr = selectComand.ExecuteReader())
{
while (rdr.Read())
{
retrievedList.Add(new CRUDInfo()
{
TableName = retriveInfo.TableName,
ObjectDictionary = Enumerable.Range(0, rdr.FieldCount).ToDictionary(rdr.GetName, rdr.GetValue)
});
}
}
}
- If use update or create, I can't use IDictionary only Dictionary. Can it be modified?
CRUDInfo.ObjectDictionary is an IDictionary<string, object>,but I can't pass it directly to GetUpdateCommand, only through the wrapper.
var changeset = new Dictionary<string, object>(CRUDInfo.ObjectDictionary);
updateCommand = dbContext.CommandBuilder.GetUpdateCommand(q, changeset)
from data.
@okedoki regarding CRUDInfo, it seems you're trying to implement the concept that looks similar to old ADO.NET DataTable/DataRow - could you check issue #2 (RecordSet implementation)? I've already added first draft of this structure: RecordSet.cs. Conceptually RecordSet works like DataTable and suitable for processing many records at once. Right now I'm working on DbDataAdapter.Select().ToRecordSet() and DbDataAdapter.Update(RecordSet) implementations -- I assume that these enhancements may make your CRUDInfo structure unnecessary.
- I didn't find a way to use create a command to work with several rows for CRUD.
For example, I expect to select records with ID =1,2,3. How can I do it?
why not make one select for selecting several records at once?.. like that:
var recordIds = new int[] { 1, 2, 3};
new Query(someTableName, new QConditionNode( (QField)"id", Conditions.In, new QConst(recordIds) ) );
- If use update or create, I can't use IDictionary only Dictionary. Can it be modified?
Oh I see, I forgot to add overload for IDictionary<string,object> in DbCommandBuilderExtensions. Give me 10 minutes :-)
from data.
@okedoki take a look to the updated SqliteDemo.DataAdapter -- I've added sample code for dictionary-driven CRUD operations, and new RecordSet.
Also all DbCommandGenerator / DbDataAdapter methods support IDictionary<string,object>. I've just published 1.0.0-alpha4 and you can try it.
from data.
It seems this question is no longer actual for latest 1.0-final release.
from data.
Related Issues (20)
- Nullable Type in Graphql Schema Object HOT 1
- Implement RecordSetReader.GetSchemaTable for compatibility with netcore3 GetColumnSchema() impl HOT 1
- Remove netstandard1.5 target and related conditional compilation ifdefs HOT 1
- DbDataAdapter.Update for RecordSet: issue with DB parameters that are not mapped to Row values HOT 1
- Add example for GraphQL subquery (nested query) HOT 1
- DBAdapter Select returns Empty Array HOT 1
- GraphQL Column Resolver and Column Cases HOT 4
- Missing type in NReco.Data Latest Stable 1.1.1 HOT 3
- Add support of aggregate queries HOT 1
- RelexBuilder throws "Query variable 'varname' is not defined" if query condition uses QVar HOT 1
- QAggregateField: ability to specify custom SQL template for aggr function HOT 1
- DbDataAdapter.Select().ExecuteReader ignores ApplyOffset option HOT 1
- Option "None" for attribute "DatabaseGenerated" was ignored HOT 1
- Loaded RecordSet.Column.DataType is null in case of some ADO.NET providers
- Please check this repo using SonarQube. HOT 2
- Not (QNegationNode) is not supported by RelexParser HOT 1
- StringTemplate - alternative syntax for tokens HOT 1
- Ability to use DB parameters for QRawSql / QRawSqlNode HOT 1
- StringTemplate support nested tokens HOT 1
- Make DbFactory.CreateConnection virtual to allow specific connection handling in inheritors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data.