小编Awa*_*dra的帖子

c#winforms应用程序中datagridview/controls中的子级对象属性绑定

在使用绑定对象列表到datagridview或控件时,我遇到了问题.实际上我想要的是,我有课时说Person,Address而且Contact.Personclass有3个属性,一个是string Add类型的Name,类型是Address,最后一个是Conttype Contact.通过谷歌搜索我发现我必须创建我创建的CustomTypeDescriptor类,它只适用于Contact或为一个类Address.当我们放两次然后它显示编译时错误,不能有重复[TypeDescriptionProvider(typeof(MyTypeDescriptionProvider<Contact>))].

我怎么解决这个问题.

在这里,我提供了我想要实现的示例代码,

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        dataGridView1.AutoGenerateColumns = false;

        dataGridView1.Columns.Add("Name", "Name");
        dataGridView1.Columns.Add("City", "City");
        dataGridView1.Columns.Add("ContactName", "ContactName");

        dataGridView1.Columns["Name"].DataPropertyName = "Name";
        dataGridView1.Columns["City"].DataPropertyName = "Add_City";
        dataGridView1.Columns["ContactName"].DataPropertyName = "Cont_ContactName";

        List<Person> PersonList = PersonProxy.GetPersonCollection();
        dataGridView1.DataSource = PersonList;
    }
}



public class PersonProxy
{
    public static List<Person> GetPersonCollection()
    { …
Run Code Online (Sandbox Code Playgroud)

c# c#-4.0

6
推荐指数
1
解决办法
6599
查看次数

如何为给定的sql查询创建条件查询

我正在为这个等效的SQL查询创建一个ICriteria查询.

SELECT fCustomerID,
       ISNULL(
                (SELECT SUM(payinv.fAmount) AS Expr1
                 FROM dbo.tARPayment AS pay
                 INNER JOIN dbo.tARPaymentInvoice AS payinv ON pay.fPaymentID = payinv.fPaymentID
                 INNER JOIN dbo.tARInvoice AS inv ON payinv.fInvoiceID = inv.fARInvoiceID
                 WHERE (pay.fIsPosted = CASE pay.fPaymentType WHEN 'CM' THEN 0 WHEN 'EPD' THEN 0 ELSE 1 END)
                   AND (inv.fCustomerID <> dbo.tARCustomer.fCustomerID)
                   AND (pay.fCustomerID = dbo.tARCustomer.fCustomerID)), 0)
FROM dbo.tARCustomer
GROUP BY fCustomerID
Run Code Online (Sandbox Code Playgroud)

但我无论如何都无法生成如何生成等效的nhibernate ICriteria查询.

这是付款类

public partial class tARPayment 
{
    #region Constructor

    /// <summary>
    /// Initializes a new instance of the <see …
Run Code Online (Sandbox Code Playgroud)

c# nhibernate hibernate fluent-nhibernate nhibernate-criteria

5
推荐指数
1
解决办法
686
查看次数

无法在Bootstrap表中使用jQuery设置data-url值

我检查了你的例子,它在你的例子中工作,但是当我在我的例子中尝试它时,它不起作用.我不知道我在哪里犯错误.是我使用旧的jQuery文件?我在这里发布了整个HTML代码.

HTML代码

@{
    Layout = null;
}


<!DOCTYPE html>
<html>
<head>
    <title>Refresh method with new url</title>
    <meta charset="utf-8">
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-table.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Scripts/bootstrap-table.js"></script>
</head>
<body>
    <div class="container">
        <div class="ribbon">
            <a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/409.html">View Source on GitHub</a>
        </div>
        <h1>Refresh method with new url(<a href="https://github.com/wenzhixin/bootstrap-table/issues/409">#409</a>).</h1>
        <div class="toolbar">
            <button id="refresh" class="btn btn-default">Refresh</button>
        </div>
        <table id="table"
               data-toggle="table"
               data-toolbar=".toolbar"
               data-url='/Report/GetShipments'>
            <thead>
                <tr>
                    <th data-field="id">ID</th>
                    <th data-field="name">Item Name</th>
                    <th data-field="price">Item Price</th>
                </tr>
            </thead>
        </table>
    </div>
    <script>
        var $table = …
Run Code Online (Sandbox Code Playgroud)

html asp.net asp.net-mvc jquery twitter-bootstrap

2
推荐指数
1
解决办法
3万
查看次数

无法从字符串值加载类型

我正在开发一个使用NHibernate和Spring.Net框架的程序.当我执行应用程序时,抛出以下异常:

创建上下文'spring.root'时出错:无法从字符串值'BlackOpsP2.Data.EmployeeDao,BlackOpsP2.Data'加载类型.

的app.config:

<?xml version="1.0"?>
<configuration> 
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821"/>
        <sectionGroup name="spring">
            <section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
            <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
            <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
        </sectionGroup>
    </configSections>

    <spring>
        <context>
            <resource uri="config://spring/objects"/>
        </context>
        <parsers>
            <parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
            <parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data"/>
        </parsers>

        <objects xmlns="http://www.springframework.net"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:tx="http://www.springframework.net/tx"
             xmlns:db="http://www.springframework.net/database">

            <db:provider id="DbProvider"
                           provider="SqlServer-2.0"
                           connectionString="Data Source=CHETUIWK123\SQL2008R2;Integrated Security=true;Database=TestNhibernate;"/>
            <object id="MySessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate33">
                <property name="ExposeTransactionAwareSessionFactory" value="true" />
                <property name="DbProvider" ref="DbProvider"/>
                <property name="MappingAssemblies">
                    <list>
                        <value>BlackOpsP2.Core</value>
                    </list>
                </property>
                <property name="HibernateProperties">
                    <dictionary>

                        <entry key="hibernate.connection.provider"
                               value="NHibernate.Connection.DriverConnectionProvider"/>

                        <entry …
Run Code Online (Sandbox Code Playgroud)

.net c# spring spring.net

1
推荐指数
1
解决办法
8330
查看次数