Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by Phil Hepburn »

Hi Robert, Team and guys,

I am now trying to get my database connections and table mappings right in X# syntax. I have had some success but am finding a few other problems. I am trying 'LINQ to SQL' before I move over to 'LINQ to Entity'.

All the code I am copying/using has worked in C#.

So far I can detect in code the possible SQL Servers, and I can create a connection string and open a database file.

My current issue is trying to define a 'DataContext' class in which I map my Tables.

Can you first of all tell me how I should place / attach the 'Attributes' in X#.

I attach samples of my previous code and also what I am trying at the moment.

HELP !!!! please .............>>

Cheers,
Phil.
RobertAttributes_02.jpg
RobertAttributes_02.jpg (100.79 KiB) Viewed 674 times
RobertAttributes_04.jpg
RobertAttributes_04.jpg (21.18 KiB) Viewed 674 times
RobertAttributes_03.jpg
RobertAttributes_03.jpg (84.53 KiB) Viewed 674 times
RobertAttributes_06.jpg
RobertAttributes_06.jpg (41.68 KiB) Viewed 674 times
RobertAttributes_01.jpg
RobertAttributes_01.jpg (73.57 KiB) Viewed 674 times
RobertAttributes_05.jpg
RobertAttributes_05.jpg (24.56 KiB) Viewed 674 times
RobertAttributes_07.jpg
RobertAttributes_07.jpg (64.63 KiB) Viewed 674 times
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by Phil Hepburn »

Should have come previously - one of those Fridays !!! ;-0((
RobertAttributes_02.jpg
RobertAttributes_02.jpg (64.63 KiB) Viewed 674 times
RobertAttributes_03.jpg
RobertAttributes_03.jpg (41.68 KiB) Viewed 674 times
RobertAttributes_01.jpg
RobertAttributes_01.jpg (21.18 KiB) Viewed 674 times
RobertAttributes_04.jpg
RobertAttributes_04.jpg (84.53 KiB) Viewed 674 times
RobertAttributes_05.jpg
RobertAttributes_05.jpg (24.56 KiB) Viewed 674 times
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by Phil Hepburn »

Hi Robert and the gang,

I have cracked my little problem I think.

I needed to include 'using System.Data.Linq.Mapping' at the head of my code section.

Remember that the Visual Studio facilities are quite reduced to what I am used to with C#. So its a bit of a fumble around - BUT - I am getting there.

Fingers crossed,
Cheers,
Phil.
RobertAttributes_11.jpg
RobertAttributes_11.jpg (100.79 KiB) Viewed 674 times
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by Phil Hepburn »

Yes, guys,

Further testing shows the attached simple LINQ query to work - this is 'LINQ to SQL' as the collection is being generated after a query is sent by the 'system' at runtime to my SQL database engine - using the MDF data file specified in the connection string.

I should be away now, foot in the door and all those sorts of comments.

Thanks for listening,
Phil.
RobertAttributes_12.jpg
RobertAttributes_12.jpg (73.57 KiB) Viewed 674 times
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by lumberjack »

Phil,

Just a question, why don't you use the Pearl NG that was setup for this purpose? Now have to go to the webbrowser to see you attachments.

LJ
______________________
Johan Nel
Boshof, South Africa
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by Phil Hepburn »

Hi LJ - sorry, but I thought my question was a general one about Language.

Have you read the published 'penalties' for posting in the wrong forum ?

If Robert, you, and others wish me to put most (all?) of my stuff in Pearls then I will do so.

It has also taken me a little while to get used to the structure and feel of this new XSharp group, remember, I have been off-line for almost seven months ;-0)

In the past we used to put stuff in Pearls which was new and interesting (and working), rather than ask questions when standard code stuff which didn't work etc..

I will listen to advice on this one.

Best Regards,
Phil.

P.S. I will make a positive posting in Pearls on how to get LINQ to SQL fully up and running - for a simple, but meaningful, example.
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by FFF »

Phil et all,
i for one vote for use of NG - to look here for something new costs more time than to check > 10 complete newsgroups... And as Wolfgang was so nice to host the NGs, we should use them ;)

Someone wanted to write a sync tool to make NG and web-fora content "identical", but this probably was swallowed by more pressing work to be done. Perhaps, if you grow tired of ground-sensors (or woodworking <g>) you might volunteer ;-?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>

Post by wriedmann »

Hi Karl,

for ease of use you are right: NG is a better tool. But if I look at Phil's messages: I think they are better in the forum. First, because formatting is better than with every newsreader, second, because they are indexable by Google, and third, they let understand every visitor of xsharp.eu that the project is living.

Wolfgang

P.S. yes, the sync tool is in the works, and if someone has more time, I can share my current code and test environment. Until the messages are plain text messages, there is no problem, but it becomes a difficult job if the messages are formatted and with inline images or attachments.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply