private static void EntityDataReader() { using (var entityConnection = new EntityConnection("name=AutoLotEntities")) // Создать объект соединения на основе файла *.config { entityConnection.Open(); const string query = "SELECT VALUE car FROM AutoLotEntities.Cars AS car"; // Построить запрос Entity SQL using (EntityCommand entityCommand = entityConnection.CreateCommand()) // Создать командный объект { entityCommand.CommandText = query; // Получить объект для чтения данных и обработать записи using (EntityDataReader entityDataReader = entityCommand.ExecuteReader(CommandBehavior.SequentialAccess)) { while (entityDataReader.Read()) { Console.WriteLine("----- RECORD -----"); Console.WriteLine("Id: {0}", entityDataReader["CarId"]); Console.WriteLine("Make: {0}", entityDataReader["Make"]); Console.WriteLine("Color: {0}", entityDataReader["Color"]); Console.WriteLine("Pet name: {0}", entityDataReader["CarNickname"]); Console.WriteLine(); } } } } }
//</snippeteSQLStructuralTypes> //string esqlQuery = @"SELECT REF(p) FROM AdventureWorksEntities.Products as p"; //<snippeteSQLRefTypes> static public void ExecuteRefTypeQuery(string esqlQuery) { if (esqlQuery.Length == 0) { Console.WriteLine("The query string is empty."); return; } using (EntityConnection conn = new EntityConnection("name=AdventureWorksEntities")) { conn.Open(); // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = esqlQuery; // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // Start reading results. while (rdr.Read()) { RefTypeVisitRecord(rdr as IExtendedDataRecord); } } } conn.Close(); } }
static public void StoredProcWithEntityCommand() { //<snippetStoredProcWithEntityCommand> using (EntityConnection conn = new EntityConnection("name=SchoolEntities")) { conn.Open(); // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = "SchoolEntities.GetStudentGrades"; cmd.CommandType = CommandType.StoredProcedure; EntityParameter param = new EntityParameter(); param.Value = 2; param.ParameterName = "StudentID"; cmd.Parameters.Add(param); // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // Read the results returned by the stored procedure. while (rdr.Read()) { Console.WriteLine("ID: {0} Grade: {1}", rdr["StudentID"], rdr["Grade"]); } } } conn.Close(); } //</snippetStoredProcWithEntityCommand> }
private void button9_Click(object sender, EventArgs e) { string testType = "Select Customers With EF and EntitySQL via Entity Client. Plan Cache Enabled: " + UseCompiledQuery.Checked; _watch.Start(testType); for (int i = 0; i < 50; i++) { using (EntityConnection conn = new EntityConnection(ConfigurationManager.ConnectionStrings["OrderITEntities"].ConnectionString)) { conn.Open(); using (EntityCommand comm = new EntityCommand("SELECT VALUE c FROM OFTYPE(OrderITEntities.Companies, OrderITModel.Customer) AS c WHERE c.name LIKE @name", conn)) { comm.EnablePlanCaching = enablePlanCaching.Checked; comm.Parameters.AddWithValue("name", "C%"); using (EntityDataReader reader = comm.ExecuteReader(CommandBehavior.SequentialAccess)) { while (reader.Read()) { var x = reader.GetValue(0); var x1 = reader.GetValue(1); var x2 = reader.GetValue(2); var x3 = reader.GetValue(3); var x4 = reader.GetValue(4); } } } } _watch.SaveLap(); } _watch.Stop(); }
private void button14_Click(object sender, EventArgs e) { string testType = "Stored Procedure via Entity Client"; _watch.Start(testType); for (int i = 0; i < 50; i++) { using (EntityConnection conn = new EntityConnection(ConfigurationManager.ConnectionStrings["OrderITEntities"].ConnectionString)) { conn.Open(); using (EntityCommand comm = new EntityCommand("OrderITEntities.GetCustomersForTest", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("name", "C%"); using (EntityDataReader reader = comm.ExecuteReader(CommandBehavior.SequentialAccess)) { while (reader.Read()) { var x = reader.GetValue(0); var x1 = reader.GetValue(1); var x2 = reader.GetValue(2); var x3 = reader.GetValue(3); var x4 = reader.GetValue(4); } } } } _watch.SaveLap(); } _watch.Stop(); }
//</snippeteSQLRefTypes> //string esqlQuery = @"SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p"; //<snippeteSQLPrimitiveTypes> static void ExecutePrimitiveTypeQuery(string esqlQuery) { if (esqlQuery.Length == 0) { Console.WriteLine("The query string is empty."); return; } using (EntityConnection conn = new EntityConnection("name=AdventureWorksEntities")) { conn.Open(); // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = esqlQuery; // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // Start reading results. while (rdr.Read()) { IExtendedDataRecord record = rdr as IExtendedDataRecord; // For PrimitiveType // the record contains exactly one field. int fieldIndex = 0; Console.WriteLine("Value: " + record.GetValue(fieldIndex)); } } } conn.Close(); } }
public void QueryContactsEntityConecction() { using (var con = new EntityConnection("name=PEF")) { con.Open(); EntityCommand cmd = con.CreateCommand(); cmd.CommandText = "SELECT VALUE c " + "FROM PEF.Contact AS c " + "WHERE c.FirstName = 'Robert'"; Dictionary <int, string> dict = new Dictionary <int, string>(); using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) { while (rdr.Read()) { int a = rdr.GetInt32(0); var b = rdr.GetString(1); dict.Add(a, b); Console.WriteLine("{0} {1}", a, b); } } Console.Write("Press Enter..."); Console.ReadLine(); } #endregion }
private static void QueryEntityClient() { using (EntityConnection conn = new EntityConnection( "name=SampleEntities")) { conn.Open(); var query = "SELECT VALUE c " + "FROM SampleEntities.Contacts AS c " + "WHERE c.FirstName = 'Robert'"; EntityCommand cmd = conn.CreateCommand(); cmd.CommandText = query; using (EntityDataReader reader = cmd.ExecuteReader( CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) { while (reader.Read()) { var firstname = reader.GetString(1); var lastname = reader.GetString(2); var title = reader.GetString(3); Console.WriteLine("{0} {1} {2}", title.Trim(), firstname.Trim(), lastname); } } conn.Close(); } }
//Entity Client 相当于实体数据库的操作 static void EntityClient() { // 创建并打开连接 EntityConnection conn = new EntityConnection(); //ARTICLE_DBEntities 对应app.config中的配置 conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ARTICLE_DBEntities"].ConnectionString; conn.Open(); // 创建并执行命令 EntityCommand cmd = new EntityCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; /* * 注意此处特别!!!注意以下两点: * 1、不支持直接使用 * * 2、表名前需要添加EDM名称,此处是 ARTICLE_DBEntities */ cmd.CommandText = "SELECT T.ID ,T.ZH_NAME ,T.NAME ,T.PWD ,T.ROLES FROM ARTICLE_DBENTITIES.T_USERS AS T"; EntityDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess); // 输出 while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { Console.Write(reader[i].ToString() + "\t"); } Console.WriteLine(); } // 关闭连接 conn.Close(); }
private static void FunWithEntityDataReader() { // Make a connection object, based on our *.config file. using (EntityConnection cn = new EntityConnection("name=AutoLotEntities")) { cn.Open(); // Now build an Entity SQL query. string query = "SELECT VALUE car FROM AutoLotEntities.Cars AS car"; // Create a command object. using (EntityCommand cmd = cn.CreateCommand()) { cmd.CommandText = query; // Finally, get the data reader and process records. using (EntityDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { while (dr.Read()) { Console.WriteLine("***** RECORD *****"); Console.WriteLine("ID: {0}", dr["CarID"]); Console.WriteLine("Make: {0}", dr["Make"]); Console.WriteLine("Color: {0}", dr["Color"]); Console.WriteLine("Pet Name: {0}", dr["CarNickname"]); Console.WriteLine(); } } } } }
//Querying with EntityClient to return Streamed Data public void QueryContacts() { using (EntityConnection conn = new EntityConnection("name=PEF")) { conn.Open(); var queryString = "SELECT VALUE c " + "FROM PEF.Contact AS c " + "WHERE c.FirstName = 'Robert'"; EntityCommand cmd = conn.CreateCommand(); cmd.CommandText = queryString; using (EntityDataReader rdr = cmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess | System.Data.CommandBehavior.CloseConnection)) { while (rdr.Read()) { var firsName = rdr.GetString(1); var lastName = rdr.GetString(2); var tittle = rdr.GetString(3); Console.WriteLine("{0} {1} {2}", tittle.Trim(), firsName.Trim(), lastName); } } conn.Close(); Console.Write("Presiona Enter"); Console.ReadLine(); } }
/// <summary> /// ESQL /// </summary> static void RSQL() { // 这个就是App.config中的数据库连接串 using (var con = new EntityConnection("name=SchoolDBEntities")) { //打开连接 con.Open(); //通过连接创建一个命令对象 EntityCommand cmd = con.CreateCommand(); //设置要执行的SQL语句或存储过程 cmd.CommandText = "select value s from SchoolDBEntities.StudentSets as s"; //定义一个接收字典 Dictionary <int, string> dic = new Dictionary <int, string>(); //创建一个reader来进行数据读取 using (EntityDataReader rd = cmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess | System.Data.CommandBehavior.CloseConnection)) { while (rd.Read()) { int a = rd.GetInt32(0); string b = rd.GetString(1); dic.Add(a, b); } } } }
private static void FunWIthEntityDataReader() { // 基于*.config文件创建一个连接对象 using (EntityConnection cn = new EntityConnection("name=AutoLotEntities")) { cn.Open(); // 构建一个Entity SQL查询 string query = "SELECT VALUE car FROM AutoLotEntities.Cars AS car"; // 创建一个命令对象 using (EntityCommand cmd = cn.CreateCommand()) { cmd.CommandText = query; // 最后,获取数据阅读器并处理得到的记录 using (EntityDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { while (dr.Read()) { Console.WriteLine("***** RECORD *****"); Console.WriteLine("ID: {0}", dr["CarID"]); Console.WriteLine("Make: {0}", dr["Make"]); Console.WriteLine("Color: {0}", dr["Color"]); Console.WriteLine("Pet Name: {0}", dr["CarNickname"]); Console.WriteLine(); } } } } }
private static void FunWithEntityDataReader() { using (EntityConnection cn = new EntityConnection("name = AutoLotEntities")) { cn.Open(); string query = "SELECT VALUE car FROM AutoLotEntities.Cars As Car"; //创建一个命令对象 using (EntityCommand cmd = cn.CreateCommand()) { cmd.CommandText = query; //使用EntityDataReader获取得到的数据 using (EntityDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess)) { while (dr.Read()) { Console.WriteLine("******Record*******"); Console.WriteLine("ID:{0}", dr["CarID"]); Console.WriteLine("Make:{0}", dr["Make"]); Console.WriteLine("Color:{0}", dr["Color"]); Console.WriteLine("Pet Name:{0}", dr["CarNickName"]); } } } } }
// Verifies that all values contained in the reader satisfy the given condition private static void VerifyValueCondition(EntityDataReader reader, Func <object, bool> condition) { while (reader.Read()) { var value = reader.GetValue(0); Assert.True(condition(value)); } }
static void TestProduct(string esqlQuery, Dictionary <string, object> parametes) { using (EntityConnection conn = new EntityConnection("name=AdventureWorksEntities")) { conn.Open(); try { // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = esqlQuery; foreach (KeyValuePair <string, object> kvp in parametes) { cmd.Parameters.AddWithValue(kvp.Key, kvp.Value); } // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // The result returned by this query contains // Address complex Types. while (rdr.Read()) { int col = rdr.FieldCount; if (rdr.FieldCount > 3) { col = 3; } for (int i = 0; i < col; i++) { Console.Write("{0} ", rdr[i]); } Console.WriteLine(); if (rdr.Depth > 0) { // Display Address information. DbDataRecord nestedRecord = rdr[0] as DbDataRecord; for (int i = 0; i < nestedRecord.FieldCount; i++) { Console.WriteLine(" " + nestedRecord.GetName(i) + ": " + nestedRecord.GetValue(i)); } } } } } } catch (EntityException ex) { Console.WriteLine(ex.ToString()); } conn.Close(); } }
private static void VerifySortDescDouble(EntityDataReader reader) { double value = double.MaxValue; while (reader.Read()) { var newValue = reader.GetDouble(0); Assert.True(value >= newValue); value = newValue; } }
private static void VerifyAgainstBaselineResults(EntityDataReader reader, IEnumerable <object> expectedResults) { var actualResults = new List <object>(); while (reader.Read()) { actualResults.Add(reader.GetValue(0)); } Assert.True(expectedResults.SequenceEqual(actualResults)); }
static void Main(string[] args) { //Database.SetInitializer(new CreateDatabaseIfNotExists<UnderwritingEntitiesContainer>()); //EF_concurrencyfeatures(); using (UnderwritingEntitiesContainer db = new UnderwritingEntitiesContainer()) { //db.Database.Log = Console.WriteLine; ////use Db table name for Sqlquery ////tightly coupled code //var headers = db.headers.SqlQuery("Select * from uw.header"); //foreach(var h in headers) //{ // Console.WriteLine("ID" + h.Id + " value " + h.PolicyReference); //} var objectContext = (db as IObjectContextAdapter).ObjectContext; RunUncompiledQuery(objectContext); RunCompiledQuery(); //Use EntitySql //strongly typed using (EntityConnection connection = objectContext.Connection as EntityConnection) { connection.Open(); EntityCommand cmd = connection.CreateCommand(); cmd.CommandText = "Select value header from UnderwritingEntitiesContainer.headers as header"; EntityDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess); while (dr.Read()) { Console.WriteLine("id " + dr["HeaderId"]); Console.WriteLine("value " + dr["PolicyReference"]); } //ObjectQuery string query = "select value h from UnderwritingEntitiesContainer.headers as h"; // Use for filter - ObjectParameter foreach (header h in new ObjectQuery <header>(query, objectContext)) { Console.WriteLine("id " + h.HeaderId + " policy " + h.PolicyReference); } connection.Close(); } } Console.ReadKey(); }
static private void ComplexTypeWithEntityCommand() { //<snippetComplexTypeWithEntityCommand> using (EntityConnection conn = new EntityConnection("name=CustomerComplexAddrContext")) { conn.Open(); // Create a query that returns Address complex type. string esqlQuery = @"SELECT VALUE customers FROM CustomerComplexAddrContext.CCustomers AS customers WHERE customers.CustomerId < 3"; try { // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = esqlQuery; // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // The result returned by this query contains // Address complex Types. while (rdr.Read()) { // Display CustomerID Console.WriteLine("Customer ID: {0}", rdr["CustomerId"]); // Display Address information. DbDataRecord nestedRecord = rdr["Address"] as DbDataRecord; Console.WriteLine("Address:"); for (int i = 0; i < nestedRecord.FieldCount; i++) { Console.WriteLine(" " + nestedRecord.GetName(i) + ": " + nestedRecord.GetValue(i)); } } } } } catch (EntityException ex) { Console.WriteLine(ex.ToString()); } conn.Close(); } //</snippetComplexTypeWithEntityCommand> }
private static void VerifySortAscAndCountInt(EntityDataReader reader, int expectedCount) { var count = 0; int id = int.MinValue; while (reader.Read()) { var newId = reader.GetInt32(0); Assert.True(id <= newId); id = newId; count++; } Assert.Equal(count, expectedCount); }
private static void VerifyTypeAndCount(EntityDataReader reader, int expectedCount, string type) { var count = 0; while (reader.Read()) { count++; } Assert.Equal(type, reader.DataRecordInfo.FieldMetadata[0].FieldType.TypeUsage.EdmType.Name); if (expectedCount >= 0) { Assert.Equal(count, expectedCount); } }
static private void ReturnNestedCollectionWithEntityCommand() { //<snippetReturnNestedCollectionWithEntityCommand> using (EntityConnection conn = new EntityConnection("name=AdventureWorksEntities")) { conn.Open(); try { // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { // Create a nested query. string esqlQuery = @"Select c.ContactID, c.SalesOrderHeader From AdventureWorksEntities.Contact as c"; cmd.CommandText = esqlQuery; // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // The result returned by this query contains // ContactID and a nested collection of SalesOrderHeader items. // associated with this Contact. while (rdr.Read()) { // the first column contains Contact ID. Console.WriteLine("Contact ID: {0}", rdr["ContactID"]); // The second column contains a collection of SalesOrderHeader // items associated with the Contact. DbDataReader nestedReader = rdr.GetDataReader(1); while (nestedReader.Read()) { Console.WriteLine(" SalesOrderID: {0} ", nestedReader["SalesOrderID"]); Console.WriteLine(" OrderDate: {0} ", nestedReader["OrderDate"]); } } } } } catch (EntityException ex) { Console.WriteLine(ex.ToString()); } conn.Close(); } //</snippetReturnNestedCollectionWithEntityCommand> }
static public void ComplexTypeWithEntityCommand() { //<snippetComplexTypeWithEntityCommand> using (EntityConnection conn = new EntityConnection("name=AdventureWorksEntities")) { conn.Open(); string esqlQuery = @"SELECT VALUE contacts FROM AdventureWorksEntities.Contacts AS contacts WHERE contacts.ContactID == @id"; // Create an EntityCommand. using (EntityCommand cmd = conn.CreateCommand()) { cmd.CommandText = esqlQuery; EntityParameter param = new EntityParameter(); param.ParameterName = "id"; param.Value = 3; cmd.Parameters.Add(param); // Execute the command. using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { // The result returned by this query contains // Address complex Types. while (rdr.Read()) { // Display CustomerID Console.WriteLine("Contact ID: {0}", rdr["ContactID"]); // Display Address information. DbDataRecord nestedRecord = rdr["EmailPhoneComplexProperty"] as DbDataRecord; Console.WriteLine("Email and Phone Info:"); for (int i = 0; i < nestedRecord.FieldCount; i++) { Console.WriteLine(" " + nestedRecord.GetName(i) + ": " + nestedRecord.GetValue(i)); } } } } conn.Close(); } //</snippetComplexTypeWithEntityCommand> }
public void UserDefinedFunction() { using (EntityConnection conn = new EntityConnection("name=testEntities")) { conn.Open(); string query = @"SELECT e.FirstName AS Name FROM testEntities.Employees AS e WHERE testModel.Store.spFunc(e.Id, '') = 6"; using (EntityCommand cmd = new EntityCommand(query, conn)) { EntityDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess); Assert.True(reader.Read()); Assert.Equal("Scooby", reader[0]); } } }
public static List <Car> GetCar() { //List<Car> result = db.Cars.ToList(); //return result; List <Car> result = new List <Car>(); var rs = db.Database.SqlQuery <string>("SELECT * FROM cars").ToList(); foreach (var row in rs) { } using (var con = new EntityConnection()) { con.Open(); EntityCommand cmd = con.CreateCommand(); cmd.CommandText = "SELECT carname FROM cars"; using (EntityDataReader edr = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) { while (edr.Read()) { Car row = new Car(); row.CarID = Convert.ToInt16(edr["CarID"]); row.CarName = Convert.ToString(edr["CarName"]); result.Add(row); } } //con.Open(); //EntityCommand cmd = con.CreateCommand(); //cmd.CommandText = "SELECT VALUE st FROM SchoolDBEntities.Students as st where st.StudentName='Bill'"; //Dictionary<int, string> dict = new Dictionary<int, string>(); //using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) //{ // while (rdr.Read()) // { // int a = rdr.GetInt32(0); // var b = rdr.GetString(1); // dict.Add(a, b); // } //} } return(result); }
protected void Page_Load(object sender, EventArgs e) { using (EntityConnection entityConn = new EntityConnection("name=Entities")) { entityConn.Open(); using (EntityCommand cmd = entityConn.CreateCommand()) { cmd.CommandText = "select value c from Entities.UserRoles as c where c.id>0 "; EntityDataReader read = cmd.ExecuteReader(); while (read.Read()) { txtbox.Text = read[0].ToString(); } } } //TestEF ef = new TestEF(); // repTest.DataSource= ef.GetAllUer(); // repTest.DataBind(); }
/// <summary> /// EntityDataReader /// </summary> /// <returns></returns> public Dictionary <int, string> GetAllCityByEntityDataReader() { using (var con = new EntityConnection("name=ManagerSiContext")) { con.Open(); EntityCommand cmd = con.CreateCommand(); cmd.CommandText = "SELECT VALUE st FROM ManagerSiContext.BASE_CITY as st WHERE st.STATE == '1'"; Dictionary <int, string> dict = new Dictionary <int, string>(); using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) { while (rdr.Read()) { int a = rdr.GetInt32(0); var b = rdr.GetString(1); dict.Add(a, b); } } return(dict); } }
//Querying with Object Services and Entity SQL //This doesn't work //static void QryOS() //{ // string sqlString = "SELECT VALUE st FROM SchoolDBEntities.Students " + // "AS st WHERE st.StudenName == 'Steve'"; // IObjectContextAdapter ctx = new // var objctx = (ctx as new IObjectContextAdapter).ObjectContext; // ObjectQuery<Student> student = objctx.CreateQuery<Student>(sqlString); // Student newStudent = student.First<Student>(); //} static void EntityConnection() { using (var con = new EntityConnection("name=SchoolDBEntities")) { con.Open(); EntityCommand cmd = con.CreateCommand(); cmd.CommandText = "SELECT VALUE st FROM SchoolDBEntities.Students as st where st.StudentName='Steve'"; Dictionary <int, string> dict = new Dictionary <int, string>(); using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.CloseConnection)) { while (rdr.Read()) { int a = rdr.GetInt32(0); var b = rdr.GetString(1); dict.Add(a, b); } } } }
private void PutLoadedStatesInCache(IEnumerable <Tuple> queryResult, EntityDataReader reader, HashSet <Key> foundedKeys) { var entityRecords = reader.Read(queryResult, Provider.Header, manager.Owner.Session); foreach (var entityRecord in entityRecords) { if (entityRecord != null) { var fetchedKey = entityRecord.GetKey(); var tuple = entityRecord.GetTuple(); if (tuple != null) { manager.SaveStrongReference(manager.Owner.UpdateState(fetchedKey, tuple)); foundedKeys.Add(fetchedKey); } } } }