Page 1 of 1

Looking for code examples of Entity Developer Linq to SQL

Posted: Tue 19 Jan 2016 16:48
by OutOfTouch6947
I am using Entity Developer Pro, the linq to sql template and I am looking for coding examples of using the model at runtime, things like setting the connection string at runtime. loading data saving data, deleting data.

Re: Looking for code examples of Entity Developer Linq to SQL

Posted: Wed 20 Jan 2016 14:14
by MariiaI
LINQ to SQL model created via Entity Developer is closely similar to standard Microsoft's model (*.dbml model). Thus, the appropriate documentation:
https://msdn.microsoft.com/en-us/librar ... .110).aspx
https://code.msdn.microsoft.com/LINQ-Sa ... s-13a42a54
and some info in the Entity Developer documentation: ORM Support -> LINQ to SQL Models

You can also take a look at LinqConnect documentation and samples, which are available here:
1) http://www.devart.com/linqconnect/docs/?
2) in the Entity Developer documentation: ORM Support -> LinqConnect
3) samples are available in the "C:\Program Files (x86)\Devart\dotConnect\Linq\Samples\" folder after installing LinqConnect (if the Samples component has been selected during installation).

LinqConnect is our own ORM solution, closely compatible to Microsoft LINQ to SQL. LinqConnect includes some features not available in other ORM solutions, e.g. LINQ to SQL. The list of the features is available here:
http://www.devart.com/linqconnect/features.html
http://www.devart.com/linqconnect/linq- ... sions.html

Re: Looking for code examples of Entity Developer Linq to SQL

Posted: Wed 24 Feb 2016 23:14
by OutOfTouch6947
I am posting to this thread because it is exactly relevant to where I am confused right now.

Ok so I get that you are basically saying just use basic Linq to SQL to write to the database.
In my model I have relationships setup, so I am wondering how would initialize a customer that can have a collection of addresses defined like this:

Code: Select all

 [Association(Name="Customer_CustomerAddress", Storage="_CustomerAddresses", ThisKey="CustomerId", OtherKey="CustomerId", DeleteRule="CASCADE")]
        public EntitySet<CustomerAddress> CustomerAddresses
        {
            get
            {
                return this._CustomerAddresses;
            }
            set
            {
                this._CustomerAddresses.Assign(value);
            }
        }
I am having hard time figuring out how to initialize my model that I generated with EntityDeveloper code first approach to do inserts. CustomerAddresses is a LookUp table in the database that has AddressId CustomerId as FK's but they also make up the tables composite primary key. I guess what I am asking is for examples of using Linq to do inserts with similar classes where the relationships are defined in the model. I get I would new up Address object and Customer Object and InsertOnSubmit(Address) and customer but I don't understand how I am to insert the record into CustomerAddress table if the address id is an identity column.

Re: Looking for code examples of Entity Developer Linq to SQL

Posted: Thu 25 Feb 2016 13:10
by MariiaI
We are sending you a small test project to the e-mail address you provided in your forum profile. Please check that is not blocked by your mail filter. Please test it and notify us about the results.
If this doesn't help, please describe the issues you are encountering in more details, modify our sample so that the issues can be reproduced and send it back to us, or send us your sample project.

Some useful information:
https://www.devart.com/linqconnect/docs ... lated.html

Re: Looking for code examples of Entity Developer Linq to SQL

Posted: Thu 25 Feb 2016 14:54
by OutOfTouch6947
This is close but in my code address is a separate table and the the CustomerAddress Table has CustomerID, AddressId as FK's and PK's.
Would this work?

Code: Select all

  CustomerAddress newCustomerAddress1 = new CustomerAddress()
            {
                Customer = newCustomer,
                Address =  newAddress
            };

Re: Looking for code examples of Entity Developer Linq to SQL

Posted: Fri 26 Feb 2016 13:21
by MariiaI
We have provided you with a small test project, helpful links and general information regarding working with the standard Microsoft technology - LINQ to SQL.
Unfortunately, your further questions are beyond the scope of our support, we provide support on technical Entity Developer/LinqConnect specific questions.
If you have any questions regarding working with Entity Developer/LinqConnect or encounter any other specific issues, errors with these products, etc., feel free to contact us.