开发者

Where are the code gen templates for .xsd datasets?

开发者 https://www.devze.com 2022-12-12 18:29 出处:网络
Do they even exist?We have a website with a massive DAL using strongly typed datasets.I think it would be great if I had a way to inject some tracing calls before and after each of the database calls.

Do they even exist? We have a website with a massive DAL using strongly typed datasets. I think it would be great if I had a way to inject some tracing calls before and after each of the database calls. I don't see any events, nor any other way to hook into the TableAdapter such that I can get tracing calls before it executes the sql.

I know that I can create partial class files that could potentially give 开发者_如何学Gome access to what I'm looking for, but that would require creating hundreds of partial classes. I was really hoping to just hook into the codegen aspect that happens to the .xsd file instead.

Any suggestions?


The docs for xsd.exe, the tool that generates the XSD's are here:

http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.80).aspx

Unfortunately I don't know of any templates, so I'm afraid you probably can't modify them.


you can try making a Linq extension

This is an example to get non deleted rows from a data table

internal static EnumerableRowCollection<T> NotDeleted<T>(this TypedTableBase<T> rows)
        where T : DataRow
    {
        return rows.Cast<T>()
            .Where(a => a.RowState != DataRowState.Deleted);
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号