使用LINQ时的业务逻辑层 [英] Business logic layer while using LINQ
问题描述
我第一次使用LINQ to sql。我正在为我的webapplication工作。我已经为.dbml类创建了一个类库,但我决定为业务逻辑添加另一个类库,它几乎包含在LINQ中抛出异常的部分类和函数。 部分 Hi, Partial 这篇关于使用LINQ时的业务逻辑层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
虽然我有正确的参考资料,但下面的代码给了我一个错误。姓氏是部分班级人员的公共财产。编译器不喜欢'lastname'。错误说明:对非共享成员的引用需要对象引用。有什么想法吗?
< span style ="font-size:x-small; color:#0000ff">
I am using LINQ to sql for the first time. I am working on the layers for my webapplication. I have created a class library for the .dbml classes, but I decided to add another class library for the business logic which will pretty much contain the partial classes and functions that throw exceptions in LINQ.
The code below is giving me an error although I have the correct references. last name is a public property in partial class person. The compiler does not like 'lastname'. The error says: Reference to a non-shared member requires an object reference. Any ideas?
推荐答案
发布一些代码,包括Partial class person中的相关代码。也许它就像套管问题一样简单。您可能知道错误告诉您它希望lastname是静态的(抱歉,在VB中共享)或者您需要使用对象引用(aPerson.lastname)
Post a little more code including the relevent code in Partial class person. Maybe it is as simple as a casing problem. As you probably know the error is telling you that it expects lastname to be static (sorry, shared in VB) or you need to use an object reference (aPerson.lastname)