当前位置: 首页>>代码示例>>C#>>正文


C# SqlQuery.InsertWithIdentity方法代码示例

本文整理汇总了C#中SqlQuery.InsertWithIdentity方法的典型用法代码示例。如果您正苦于以下问题:C# SqlQuery.InsertWithIdentity方法的具体用法?C# SqlQuery.InsertWithIdentity怎么用?C# SqlQuery.InsertWithIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlQuery的用法示例。


在下文中一共展示了SqlQuery.InsertWithIdentity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertWithIdentityQuery

        public void InsertWithIdentityQuery()
        {
            using (var db = _connectionFactory.CreateDbManager())
            {
                db.BeginTransaction();

                var dataProduct = new DataProductPending
                    {
                        Activation = 0,
                        Commentary = "Valeriu",
                        DateCreation = DateTime.Now,
                        DateModification = DateTime.Now,
                        ProductPending = "Valeriu",
                        IdUserCreate = 0,
                        UserProgram = "Valeriu"
                    };

                var query = new SqlQuery(db);
                var res = query.InsertWithIdentity(dataProduct);

                db.RollbackTransaction();

                Console.WriteLine(res);
                Console.WriteLine(db.LastQuery);
            }
        }
开发者ID:starteleport,项目名称:bltoolkit,代码行数:26,代码来源:AssociationTests.cs

示例2: InsertBlob

        public void InsertBlob()
        {
            using (var db = _connectionFactory.CreateDbManager())
            {
                var sqlQuery = new SqlQuery(db);

                var session = new static_nav_session
                    {
                        PDF_USER_FILENAME = "PDF_USER_FILENAME",
                        ID_LOGIN = 1,
                        STATUS = 3,
                        PDF_NAME = "COCO",
                        ID_PDF_RESULT_TYPE = 29,
                        STATIC_NAV_SESSION = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new DataMedia {Activation = 2, IdLanguageData = 123, IdMedia = 2002, Media = "COCO"}))
                    };

                var sessionId = sqlQuery.InsertWithIdentity(session);
                Console.WriteLine(sessionId);
            }
        }
开发者ID:starteleport,项目名称:bltoolkit,代码行数:20,代码来源:AssociationTests.cs

示例3: InsertDataRadio

        public void InsertDataRadio()
        {
            using (new ExecTimeInfo())
            {
                using (var db = _connectionFactory.CreateDbManager())
                {
                    db.BeginTransaction();

                    try
                    {
                        var baseData = db.GetTable<DATA_RADIO>()
                                         .Single(d => d.ID_DATA_VERSION == 242000147724 &&
                                                      d.IdCobAdvert == 1);

                        baseData.ID_DATA_RADIO = 0; // Optional
                        baseData.IdCobAdvert = 3;
                        baseData.ID_PRODUCT = 180000;
                        baseData.DATE_MODIFICATION = DateTime.Now;

                        var query = new SqlQuery(db);
                        var count = (long) query.InsertWithIdentity(baseData);
                        Console.WriteLine(count + " -> " + db.LastQuery);
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    finally
                    {
                        db.RollbackTransaction();
                    }
                }
            }
        }
开发者ID:starteleport,项目名称:bltoolkit,代码行数:34,代码来源:AssociationTests.cs

示例4: InsertArtistWithAutoSequence

        public void InsertArtistWithAutoSequence()
        {
            using (var db = _connectionFactory.CreateDbManager())
            {
                var query = new SqlQuery(db);
                var artist = new Label {Name = "TEST", DATE_CREATION = DateTime.Now, DATE_MODIFICATION = DateTime.Now, ACTIVATION = 10, ID_USER_ = 200};

                query.InsertWithIdentity(new DataImport
                    {
                        Commentary = "aaaa",
                        DeclaredProduct = "ssfsfsfsfsfsf",
                        IdMedia = 2024,
                        DeclaredId = 1
                    });
            }
        }
开发者ID:starteleport,项目名称:bltoolkit,代码行数:16,代码来源:AssociationTests.cs


注:本文中的SqlQuery.InsertWithIdentity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。