0

Hi,

I have a filestream enabled DB and a table to store the files. Until now i used to get the path of the file that has to be saved to DB. But due to some changes this was changed and now i get a byte array. my question here is
1. Can this be done? (if yes, then how? Note: the present implementation is a stored procedure that will get the path)
2. Does this implementation have any advantages - performance wise?

1
Contributor
2
Replies
16
Views
2 Years
Discussion Span
Last Post by necrovore
0

I have a little bit more information at this point of time. I am using edmx and in the classes that are generated the type of the varbinary(max) column of the table is byte[]. So i tried to add the byte raay to this bute array and save the record.. but now the id field (a guid column) of the table is always same.

following is the table script:

CREATE TABLE [dbo].[BinaryFileSource](
    [BinaryFileSourceID] UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL,
    [FileObject] varbinary(max) FILESTREAM NULL,
    CONSTRAINT UQ_BinaryFileSource_FileID UNIQUE (BinaryFileSourceID)
)
GO
ALTER TABLE [dbo].[BinaryFileSource]
    ADD CONSTRAINT DF_BinaryFileSource_BinaryFileSourceID DEFAULT NEWID() FOR BinaryFileSourceID
GO
ALTER TABLE [dbo].[BinaryFileSource]
    ADD CONSTRAINT PK_BinaryFileSource_BinaryFileSourceID PRIMARY KEY (BinaryFileSourceID)
GO
0

This problem is solved.. the GUID of 0000...... is assigned default by the entity framework. SO the default part of the table was never being used.. Now i have send a GUID from code-side.. Works Fine.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.