微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将ASP.NET XSD数据集转换为Windows窗体

如何解决将ASP.NET XSD数据集转换为Windows窗体

|| 有没有一种方法可以将XSD ASP.NET文件转换为Windows Forms XSD?有这个工具吗?我确定如果您浏览每个文件都可以完成此操作,但是是否可以轻松进行转换(也许在Visual Studio中)?     

解决方法

        我已经在Windows Forms项目和ASP.NET项目中创建了两个数据集,并进行了比较(使用Visual Studio 2010)。它们几乎相同,除了两点: Windows窗体生成具有乐观并发性的SQL语句,而ASP.NET没有
Connection
个元素不同(由于设定来源) 我认为可以编写一个简单的XSLT来更改
Connection
元素,并保留其他所有内容。 另外,添加现有的.xsd数据集文件时,应在Visual Studio的文件属性中将“ 2”设置为“ 3”,否则Visual Studio不会刷新“ 4”文件。 (更新)这是此类XSLT的简单示例(未完成):
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<xsl:stylesheet version=\"1.0\"
                xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
                xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"
                exclude-result-prefixes=\"msxsl\"
                xmlns=\"http://tempuri.org/DataSet1.xsd\"
                xmlns:mstns=\"http://tempuri.org/DataSet1.xsd\"
                xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"
                xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\"
                xmlns:msprop=\"urn:schemas-microsoft-com:xml-msprop\"
                xmlns:msds=\"urn:schemas-microsoft-com:xml-msdatasource\">
    <xsl:output method=\"xml\" indent=\"yes\"/>

    <xsl:template match=\"@* | node()\">
        <xsl:copy>
            <xsl:apply-templates select=\"@* | node()\"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match=\"msds:Connection\">
        <xsl:copy>
            <xsl:attribute name=\"AppSettingsObjectName\">Settings</xsl:attribute>
            <xsl:attribute name=\"AppSettingsPropertyName\">
                <xsl:value-of select=\"@AppSettingsPropertyName\" />
            </xsl:attribute>
            <!-- TODO: add other attributes... -->
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>
    

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。