Page 1 of 1
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 11:36 am
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 (100.79 KiB) Viewed 654 times
- RobertAttributes_04.jpg (21.18 KiB) Viewed 654 times
- RobertAttributes_03.jpg (84.53 KiB) Viewed 654 times
- RobertAttributes_06.jpg (41.68 KiB) Viewed 654 times
- RobertAttributes_01.jpg (73.57 KiB) Viewed 654 times
- RobertAttributes_05.jpg (24.56 KiB) Viewed 654 times
- RobertAttributes_07.jpg (64.63 KiB) Viewed 654 times
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 11:38 am
by Phil Hepburn
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 1:45 pm
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 (100.79 KiB) Viewed 654 times
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 1:56 pm
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 (73.57 KiB) Viewed 654 times
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 2:14 pm
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
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 2:51 pm
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.
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Fri Nov 04, 2016 4:52 pm
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 ;-?
Setting Attributes - X# syntax - for 'LINQ to SQL' etc. .... >>
Posted: Sun Nov 06, 2016 8:12 am
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.