Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemWatcher not working properly #110

Closed
rojepp opened this issue Feb 12, 2015 · 5 comments · Fixed by #116
Closed

FileSystemWatcher not working properly #110

rojepp opened this issue Feb 12, 2015 · 5 comments · Fixed by #116

Comments

@rojepp
Copy link
Contributor

rojepp commented Feb 12, 2015

I was surprised to see changes to my sql file not being picked up:

  type Assessments  = SqlCommandProvider< "sql/Assessment.sql", cn>

So I looked in the code and found that the FileSystemWatcher would watch the source folder, with a filter of 'sql/Assessments.sql'. So I changed it to this and it worked:

  type Assessments  = SqlCommandProvider<"Assessment.sql", cn, ResolutionFolder = "sql">

Then, I couldn't load this .fs file from another folder, so I changed it to

  [<Literal>] 
  let AssessmentFile = __SOURCE_DIRECTORY__ + "/sql/Assessment.sql"
  type Assessments  = SqlCommandProvider<AssessmentFile, cn>

and it compiles, but stops picking upp changes because the FSW code seems to fail when file is rooted. And this final scenario works, even when doing #load from another folder:

  [<Literal>] 
  let sqlFolder = __SOURCE_DIRECTORY__ + "/sql/"
  type Assessments  = SqlCommandProvider<"Assessments.sql", cn, ResolutionFolder = sqlFolder>

Question: What is the purpose of ResolutionFolder? The TP will only ever read one file.

These are the changes I'd like to see:

  • Unless path is rooted, use the file directory as root, so no need for __SOURCE_DIRECTORY__ to make it loadable from scripts in other folders.
  • Make the FileSystemWatcher work with rooted paths as well as unrooted partial paths ('sql/file.sql').
  • Remove ResolutionFolder. It no longer serves a purpose.
    These together would make the simplest first scenario Just Work™
@dmitry-a-morozov
Copy link
Member

I'll have a look. It will take take some time because I'm swamped with my primary work.

@rojepp
Copy link
Contributor Author

rojepp commented Feb 12, 2015

Would you accept a PR with the changes I've outlined?

@dmitry-a-morozov
Copy link
Member

I don't use *.sql file much so it's hard for me to make this call.
Probably you're right.
Here is relevant discussion
#64
Let me check first if "ResolutionFolder" param is used in any of Tachyus prod projects.

@rojepp
Copy link
Contributor Author

rojepp commented Feb 13, 2015

@dmitry-a-morozov I went ahead and implemented it. Feel free to ignore if you think its a bad idea. :)
This is a breaking change, but you wouldn't update to a newer version without recompiling, right? :)

@dmitry-a-morozov
Copy link
Member

Cool,
Thanks for help.

smoothdeveloper pushed a commit to smoothdeveloper/FSharp.Data.SqlClient that referenced this issue May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants