codeice / linqtoexcel

Automatically exported from code.google.com/p/linqtoexcel
0 stars 0 forks source link

From example: StrictMappingType? not excepting bool #90

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When following the example in the wiki:

excel.StrictMapping = true;

I get the error: "Cannot implicitly convert type 'bool' to 
'LinqToExcel.Query.StrictMappingType?'"

Perhaps I'm just missing something obvious, but it's like StrictMappingType 
isn't a bool.

My code is:

void Main()
{

    string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
    string filename = "jobgroupimport.csv";

    string fullPathAndFileName = Path.Combine(path, filename);

    var csv = new ExcelQueryFactory(fullPathAndFileName);
    csv.StrictMapping = true;

    var users = from u in csv.Worksheet<User>()
                select u;

}

class User
{
    public int UserID { get; set; }
    public string Name { get; set; }
    public string UserEmployeeNumber { get; set; }
    public int? JobGroupID { get; set; }
}

Original issue reported on code.google.com by alexander.key@gmail.com on 18 Jun 2013 at 3:17

GoogleCodeExporter commented 8 years ago
I'm guessing that the documentation needs updating to show that it's an enum 
e.g.

csv.StrictMapping = StrictMappingType.ClassStrict;

(my IDE wasn't showing the intellisense straight away)

Original comment by alexander.key@gmail.com on 18 Jun 2013 at 3:20

GoogleCodeExporter commented 8 years ago
Sorry, I haven't been maintaining the documentation on Google Code. The 
official documentation is on Github, and you can view it at this link: 
https://github.com/paulyoder/LinqToExcel#strict-mapping

I also updated the documentation on this site to point to Github's 
documentation.

Original comment by paulyo...@gmail.com on 18 Jun 2013 at 3:25

GoogleCodeExporter commented 8 years ago
I just saw that the readme does show the enum, but the wiki page doesn't. So it 
just needs updating.

Keep up the good work. Great project.

Original comment by alexander.key@gmail.com on 18 Jun 2013 at 3:31

GoogleCodeExporter commented 8 years ago
Cool thanks.

Original comment by alexander.key@gmail.com on 19 Jun 2013 at 8:53