コード例 #1
0
        public AuditLogViewerResponse List(IDbConnection connection, AuditLogViewerRequest request)
        {
            var response = new AuditLogViewerResponse();

            var    rowType       = Q.GetRowTypeByFormKey(request.FormKey);
            string connectionKey = Q.GetConnectionKeyByRowType(rowType);
            string tableName     = Q.GetTableNameByRowType(rowType);
            var    fld           = AuditLogRow.Fields;

            response.EntityVersions = connection.List <AuditLogRow>(fld.EntityTableName == tableName &&
                                                                    fld.EntityId == request.EntityId).ToList();


            return(response);
        }
コード例 #2
0
        public AuditLogViewerResponse List(AuditLogViewerRequest request)
        {
            var response = new AuditLogViewerResponse();

            var    rowType       = Q.GetRowTypeByFormKey(request.FormKey);
            string connectionKey = Q.GetConnectionKeyByRowType(rowType);
            string tableName     = Q.GetTableNameByRowType(rowType);

            // Open database (or create if doesn't exist)
            var constr = ConfigurationManager.ConnectionStrings["LogLiteDB"].ConnectionString;

            //if (constr.IsTrimmedEmpty()) return;
            using (var db = new LiteDatabase(constr))
            {
                var collectionName = tableName?.Replace('.', '_');
                var collections    = db.GetCollection <VersionInfo>(collectionName);

                response.EntityVersions = collections.Find(x => x.EntityId == request.EntityId).ToList();
            }

            return(response);
        }