Hello,
I have the following code which is an entity for a table in my database.
but I am getting several errors such as:
The type or namespace name 'ColumnAttribute' could not be found (are you
missing a using directive or an assembly reference?)
Using the generic type 'System.Data.Linq.Table<TEntity>' requires '1' type
arguments
What is the problem and how can I solve it?
Regards
[Table(Name = "Items")]
public class Items
{
[Column(IsPrimaryKey = true)]
public int Title { get; set; }
[Column]
public string Desc { get; set; }
}
Ignacio Machin ( .NET/ C# MVP ) - 31 Jul 2008 18:43 GMT
> Hello,
>
[quoted text clipped - 28 lines]
>
> - Show quoted text -
The [Column] attribute is not being found, are you using the correct
include directive?
Peter Duniho - 31 Jul 2008 18:47 GMT
> [...]
> The type or namespace name 'ColumnAttribute' could not be found (are you
[quoted text clipped - 5 lines]
>
> What is the problem and how can I solve it?
No doubt, the errors are correct. The first one is very clear about how
to fix it: you are missing either a using directive or assembly reference
(or possibly both).
Without a concise-but-complete code sample, it's not possible to comment
on whether you're missing the using directive. And you'll have to check
yourself to make sure the project includes the necessary reference to the
System.Data.Linq assembly.
Note that this is from LINQ and so you have to be using .NET 3.5.
My guess is that if you resolve the first error, that will address the
second as well.
Pete