小编use*_*037的帖子

流畅的NHibernate 3 uniquekey自定义约束名称

我试图给出一个自定义唯一约束名称如下:

Map(x => x.Name).UniqueKey("MY_CONSTRAINT_NAME").Column("FUNCTION_NAME");
Run Code Online (Sandbox Code Playgroud)

字段使用唯一约束进行映射,但约束名称是自我管理的,并且不采用我选择的名称("MY_CONSTRAINT_NAME")这是一个BUG还是我错误地使用它?

constraints fluent-nhibernate unique-key

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

WCF + Silverlight + HttpContext.Current.Session为null

我的问题....

我正在尝试从Silverlight和WCF basicHttpBinding访问会话...

我看到了一些可能的帖子(http://www.dotnetspider.com/Silverlight-Tutorial-317.aspx)

Mys cenario是:

Silvelright 4 FW 3.5

在web.config我有

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ViewModelDemo.Web.Service1Behavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="ViewModelDemo.Web.Service1Behavior" name="ViewModelDemo.Web.Service1">
            <endpoint address="" binding="basicHttpBinding" contract="ViewModelDemo.Web.Service1">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

和我的服务:

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class Service1
{
    [OperationContract]
    publicvoid Test()
    {
        var session = System.Web.HttpContext.Current.Session;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是电话

                var client = new Service1Client();
                client.GetUserMacroFunctionsCompleted += new System.EventHandler<GetUserMacroFunctionsCompletedEventArgs>(client_GetUserMacroFunctionsCompleted);
                client.GetUserMacroFunctionsAsync(); …
Run Code Online (Sandbox Code Playgroud)

silverlight session wcf basichttpbinding

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

Oracle.DataAccess(ODP.NET)数组绑定"值不在预期范围内"

我的情景

我使用ODP.NET Oracle提供与C#3.5,我想传递一个数组作为参数的程序......这样的:

var paramNames = new OracleParameter();
paramNames.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
paramNames.ParameterName = "P_JOB_TITLE";
paramNames.Size = 2;
paramNames.Value =  new string[2]{ "name1", "name1" };
cmd.Parameters.Add(paramNames);
Run Code Online (Sandbox Code Playgroud)

当运行时代码转到paramNames.Value = new string [2] {"name1","name1"}; 它抓住了这个错误

"价值不在预期范围内"

任何人都可以解决它?

附加信息

指定OracleDbType错误是固定的,但执行会给我一些错误

paramNames.OracleDbType = OracleDbType.Varchar2;
Run Code Online (Sandbox Code Playgroud)

"无法将'System.String []'类型的对象强制转换为'System.IConvertible'."

我的目标是做这样的事情

http://aspalliance.com/621_Using_ODPNET_to_Insert_Multiple_Rows_within_a_Single_Round_Trip.3

另外一个没有参数的问题

像这样插入一个out参数

            paramNames = new OracleParameter();
            paramNames.ParameterName = "O_JOB_ID";
            paramNames.Size = 3;
            paramNames.Direction = ParameterDirection.Output;
            paramNames.OracleDbType = OracleDbType.Int32;
            paramNames.Value = new int[3] { 0, 0, 0 }; ;
            cmd.Parameters.Add(paramNames);
Run Code Online (Sandbox Code Playgroud)

当ExecuteNonQuery完成时,它被正确填充.例如,pls-sql过程执行3次插入,并返回每个数组记录的row-id.

但是我出了点问题,例如在第二行有效,整个OUT参数(数组)总是设置为0.我预计至少params [0] .value被增强了

谢谢

c# arrays oracle binding odp.net

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

流利的Nhibernate 3映射复合字段(自定义类型)

好吧,我的情景

public class Permission
{
    public virtual Function Function { get; set; }
    public virtual Profile Profile { get; set; }
}

public class MapPermission : ClassMap<Permission>
{
    public MapPermission()
    {
        Table("Permissions".ToUpper());
        CompositeId().KeyProperty(x => x.Function, "FunctionID").KeyProperty(x => x.Profile, "ProfileID");

    }
}
Run Code Online (Sandbox Code Playgroud)

其中Function AND Profile是两个简单映射的实体.当我运行我有这个错误:

无法确定类型:Data.Model.Entities.Function,Data.Model,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null,对于列:NHibernate.Mapping.Column(FunctionID)"}

有办法避免这种情况吗?最终我需要创建一个由两个自定义映射类构成的CompositeID类.如果我将compositeID与int字段一起使用,它就像魅力一样

提前致谢

功能(如配置文件)映射

public class Function
{
    public virtual int ID { get; set; }
    public virtual string Name { get; set; }
}

public class MapFunction : ClassMap<Function> …
Run Code Online (Sandbox Code Playgroud)

fluent-nhibernate composite-id custom-type

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