EF中使用SqlQuery执行语句


            string sql = @"
                        SELECT     B.[FId], 
                                A.[FileTypeNo], 
                                A.[FtypeName], 
                                A.[FtypeId], 
                                A.[ProcessName],
                                A.[ProcessId],
                                B.[InstanceId],
                                B.[Status]
                        FROM    [Process] AS A
                        INNER   JOIN [ProcessInstance] AS B ON A.[ProcessId]=B.[ProcessId]
                        WHERE   B.[UserId]=@userId AND A.[FileTypeNo]=@FileTypeNo";
            using(DbHelper<Process> pDb = new DbHelper<Process>())
            {
                var userNameParam = new System.Data.SqlClient.SqlParameter
                {
                    ParameterName = "@userId",
                    Value = userId
                };
                var fileTypeNoParam = new System.Data.SqlClient.SqlParameter
                {
                    ParameterName = "@fileTypeNo",
                    Value = fileTypeNo
                };
                var info = pDb.Database.SqlQuery<ProcessAllInfoDto>(sql, userNameParam, fileTypeNoParam).FirstOrDefault();
                return info;
            }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM