Last post Aug 21, 2007 04:10 PM by algoaddict
Aug 21, 2007 08:04 AM|algoaddict|LINK
1/ im modeling my database structure and created a class in wich i want to have some properties of image type.
i need to provide the class datatype and the db datatype.
what do i choose ? image for the db and object for the class ? or theres another way ?
2/ can i write stored procedures directly with linq ? how do i do that ? where on vs ? the method pane ?
Aug 21, 2007 01:27 PM|phuff|LINK
algo, Linq provides an abstraction on top of an existing database. It doesn't create the database or table schema for you. In other words, you need to create your Image column in the database table yourself and then run SqlMetal or Blinq to create a way
for Linq to access the members of that column. Same thing goes for stored procedures: create them in SQL, and then you can call them using Linq.
Hope this helps...
Aug 21, 2007 01:59 PM|algoaddict|LINK
what ??? i think your wrong because when i add a class i can add properties and constraints and create a complete data model.
if i should already have a db to use linq, and the only way to use link or in this case the dbml is to read the existing schema, why should i have the ability to model one ?
my logic tells me that this is like all case tools for modeling databases and i can create a db using the schema that i built, i just do find the way to do so.
and im certin that i heard it can be done in one of the webcasts i watched.
Aug 21, 2007 02:08 PM|algoaddict|LINK
Since entity classes have attributes describing the structure of the relational database tables and columns, it is possible to use this information to create new instances of your database. You can call the
CreateDatabase() method on the DataContext to have LINQ to SQL construct a new database instance with a structure defined by your objects. There are many reasons you might want to do this: you might be building an application that automatically
installs itself on a customer system, or a client application that needs a local database to save its offline state. For these scenarios, the
CreateDatabase() is ideal—especially if a known data provider like SQL Server Express 2005 is available.
However, the data attributes may not encode everything about an existing database structure. The contents of user-defined functions, stored procedures, triggers, and check constraints are not represented by the attributes. The
CreateDatabase() function will only create a replica of the database using the information it knows, which is the structure of the database and the types of columns in each table. Yet, for a variety of databases this is sufficient.
Aug 21, 2007 02:14 PM|phuff|LINK
Since you're asking this on the Blinq forum, I assumed you were asking about what Blinq and the May 06 Linq Preview support. If you have more general questions about non-Blinq related Linq tools and more recent features, you might try posting on the Linq
Aug 21, 2007 04:10 PM|algoaddict|LINK
sorry, my mistake..