小编Hid*_*dan的帖子

实体框架生成缺少实体

我正在尝试使用ADO.NET实体数据模型项从我的SQL数据库生成我的实体,并使用ADO.NET DbContext Generator从那里生成实体.当我从数据库生成我的edmx时,我的一个实体似乎在设计器中丢失,但是当我查看edmx后面的代码时,我在代码中看到它,当我生成dbContext时,实体根本就没有生成. ..

任何建议将不胜感激!

visual-studio-2010 entity-framework-4.1

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

远程服务器返回错误:(401)未经授权.在ASP.NET中使用CSOM

我试图提取一些我创建的SharePoint 2013列表数据,这些数据在我的机器上本地运行时运行正常,并且在本地运行一个服务器.在服务器上本地和本地运行时,我使用相同的凭据.问题是,当我发布并导航到服务器上的ASP.NET应用程序时,我得到"远程服务器返回错误:(401)未经授权." 错误...

我查看了stackoverflow上的一些帖子以及网络上的其他一些文章

这指出上下文似乎正在使用IUSR:http: //blogs.msdn.com/b/sridhara/archive/2014/02/06/sharepoint-2013-csom-call-from-web-part-fails-与-401换全users.aspx

这个提到尝试设置默认网络凭据:https: //sharepoint.stackexchange.com/questions/10364/http-401-unauthorized-using-the-managed-client-object-model

我尝试使用文章中提到的修复程序以及尝试强制上下文使用DefaultNetworkCredentials但没有运气.我想让应用程序使用登录用户的凭据而不是机器...

这是我正在使用的代码:

        SP.ClientContext context = new SP.ClientContext("MySPDevInstance");
        context.Credentials = CredentialCache.DefaultNetworkCredentials;

        Entity entity = context.Web.GetEntity(collectionNamespace, collectionName);
        LobSystem lobSystem = entity.GetLobSystem();
        LobSystemInstanceCollection lobSystemInstanceCollection = lobSystem.GetLobSystemInstances();

        context.Load(lobSystemInstanceCollection);
        context.ExecuteQuery();

        LobSystemInstance lobSystemInstance = lobSystemInstanceCollection[0];
        FilterCollection filterCollection = entity.GetFilters(filter);

        filterCollection.SetFilterValue("LimitFilter", 0, 1000);

        EntityInstanceCollection items = entity.FindFiltered(filterCollection, filter, lobSystemInstance);
Run Code Online (Sandbox Code Playgroud)

服务器正在运行IIS 6.0

任何建议将不胜感激!

谢谢

asp.net sharepoint http-status-code-401 asp.net-mvc-4 csom

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

将Object设置为自己的VB.NET实例

我现在正在使用一个测试对象作为一个非常大的对象(700左右的属性)的概念证明.

基本上我要做的是用一个新的构造函数设置对象中的数据,而不必手动设置属性,因为有这么多.例如

Person.Name = "Bob"
Person.Age = 30
etc...
Run Code Online (Sandbox Code Playgroud)

相反,我要做的是通过反射遍历对象中的属性并在对象中设置属性.数据来自巨型字符串中的大型机......

Private _person As Person

Public Sub New(ByVal personData As String)
    _person = TryCast(ConvertStringToObject(personData, Me.GetType), Person)
End Sub

Public Property FirstName As String
    Get
        Return _person.FirstName
    End Get
    Set(ByVal value As String)
        _person.FirstName = value
    End Set
End Property

 Private Function ConvertStringToObject(ByVal data As String, ByVal obj As Object) As Object

    Dim objectType As Type = obj.GetType
    Dim properties As PropertyInfo() = objectType.GetProperties

    For Each objProperty As PropertyInfo In properties

        'just …
Run Code Online (Sandbox Code Playgroud)

.net vb.net oop reflection

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